HACK: pinfo->private_data points to smb_info again
[wireshark-wip.git] / epan / dissectors / packet-tcap.c
blob84ae484c70fc0662bba86c7d950dc7c11d70157e
1 /* Do not modify this file. Changes will be overwritten. */
2 /* Generated 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 . -O ../../epan/dissectors tcap.asn UnidialoguePDUs.asn DialoguePDUs.asn */
6 /* Input file: packet-tcap-template.c */
8 #line 1 "../../asn1/tcap/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>
14 * $Id$
16 * Wireshark - Network traffic analyzer
17 * By Gerald Combs <gerald@wireshark.org>
18 * Copyright 1998 Gerald Combs
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.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
33 * References: ETSI 300 374
36 #include "config.h"
38 #include <glib.h>
39 #include <epan/packet.h>
40 #include <epan/exceptions.h>
41 #include <epan/prefs.h>
42 #include <epan/oids.h>
43 #include <epan/asn1.h>
44 #include <epan/strutil.h>
45 #include <epan/show_exception.h>
47 #include <string.h>
48 #include "packet-ber.h"
49 #include "packet-tcap.h"
50 #include <epan/tcap-persistentdata.h>
52 #define PNAME "Transaction Capabilities Application Part"
53 #define PSNAME "TCAP"
54 #define PFNAME "tcap"
56 /* Initialize the protocol and registered fields */
57 static int proto_tcap = -1;
58 static int hf_tcap_tag = -1;
59 static int hf_tcap_length = -1;
60 static int hf_tcap_data = -1;
61 static int hf_tcap_tid = -1;
63 int hf_tcapsrt_SessionId=-1;
64 int hf_tcapsrt_Duplicate=-1;
65 int hf_tcapsrt_BeginSession=-1;
66 int hf_tcapsrt_EndSession=-1;
67 int hf_tcapsrt_SessionTime=-1;
70 /*--- Included file: packet-tcap-hf.c ---*/
71 #line 1 "../../asn1/tcap/packet-tcap-hf.c"
72 static int hf_tcap_UniDialoguePDU_PDU = -1; /* UniDialoguePDU */
73 static int hf_tcap_DialoguePDU_PDU = -1; /* DialoguePDU */
74 static int hf_tcap_oid = -1; /* OBJECT_IDENTIFIER */
75 static int hf_tcap_dialog = -1; /* Dialog1 */
76 static int hf_tcap_unidirectional = -1; /* Unidirectional */
77 static int hf_tcap_begin = -1; /* Begin */
78 static int hf_tcap_end = -1; /* End */
79 static int hf_tcap_continue = -1; /* Continue */
80 static int hf_tcap_abort = -1; /* Abort */
81 static int hf_tcap_dialoguePortion = -1; /* DialoguePortion */
82 static int hf_tcap_components = -1; /* ComponentPortion */
83 static int hf_tcap_otid = -1; /* OrigTransactionID */
84 static int hf_tcap_dtid = -1; /* DestTransactionID */
85 static int hf_tcap_reason = -1; /* Reason */
86 static int hf_tcap_p_abortCause = -1; /* P_AbortCause */
87 static int hf_tcap_u_abortCause = -1; /* DialoguePortion */
88 static int hf_tcap__untag_item = -1; /* Component */
89 static int hf_tcap_invoke = -1; /* Invoke */
90 static int hf_tcap_returnResultLast = -1; /* ReturnResult */
91 static int hf_tcap_returnError = -1; /* ReturnError */
92 static int hf_tcap_reject = -1; /* Reject */
93 static int hf_tcap_returnResultNotLast = -1; /* ReturnResult */
94 static int hf_tcap_invokeID = -1; /* InvokeIdType */
95 static int hf_tcap_linkedID = -1; /* InvokeIdType */
96 static int hf_tcap_opCode = -1; /* OPERATION */
97 static int hf_tcap_parameter = -1; /* Parameter */
98 static int hf_tcap_resultretres = -1; /* T_resultretres */
99 static int hf_tcap_errorCode = -1; /* ErrorCode */
100 static int hf_tcap_invokeIDRej = -1; /* T_invokeIDRej */
101 static int hf_tcap_derivable = -1; /* InvokeIdType */
102 static int hf_tcap_not_derivable = -1; /* NULL */
103 static int hf_tcap_problem = -1; /* T_problem */
104 static int hf_tcap_generalProblem = -1; /* GeneralProblem */
105 static int hf_tcap_invokeProblem = -1; /* InvokeProblem */
106 static int hf_tcap_returnResultProblem = -1; /* ReturnResultProblem */
107 static int hf_tcap_returnErrorProblem = -1; /* ReturnErrorProblem */
108 static int hf_tcap_localValue = -1; /* INTEGER */
109 static int hf_tcap_globalValue = -1; /* OBJECT_IDENTIFIER */
110 static int hf_tcap_nationaler = -1; /* INTEGER_M32768_32767 */
111 static int hf_tcap_privateer = -1; /* INTEGER */
112 static int hf_tcap_unidialoguePDU = -1; /* AUDT_apdu */
113 static int hf_tcap_audt_protocol_version = -1; /* AUDT_protocol_version */
114 static int hf_tcap_audt_application_context_name = -1; /* AUDT_application_context_name */
115 static int hf_tcap_audt_user_information = -1; /* AUDT_user_information */
116 static int hf_tcap_audt_user_information_item = -1; /* EXTERNAL */
117 static int hf_tcap_dialogueRequest = -1; /* AARQ_apdu */
118 static int hf_tcap_dialogueResponse = -1; /* AARE_apdu */
119 static int hf_tcap_dialogueAbort = -1; /* ABRT_apdu */
120 static int hf_tcap_aarq_protocol_version = -1; /* AARQ_protocol_version */
121 static int hf_tcap_aarq_application_context_name = -1; /* AARQ_application_context_name */
122 static int hf_tcap_aarq_user_information = -1; /* AARQ_user_information */
123 static int hf_tcap_aarq_user_information_item = -1; /* EXTERNAL */
124 static int hf_tcap_aare_protocol_version = -1; /* AARE_protocol_version */
125 static int hf_tcap_aare_application_context_name = -1; /* AARE_application_context_name */
126 static int hf_tcap_result = -1; /* Associate_result */
127 static int hf_tcap_result_source_diagnostic = -1; /* Associate_source_diagnostic */
128 static int hf_tcap_aare_user_information = -1; /* AARE_user_information */
129 static int hf_tcap_aare_user_information_item = -1; /* EXTERNAL */
130 static int hf_tcap_abort_source = -1; /* ABRT_source */
131 static int hf_tcap_abrt_user_information = -1; /* ABRT_user_information */
132 static int hf_tcap_abrt_user_information_item = -1; /* EXTERNAL */
133 static int hf_tcap_dialogue_service_user = -1; /* T_dialogue_service_user */
134 static int hf_tcap_dialogue_service_provider = -1; /* T_dialogue_service_provider */
135 /* named bits */
136 static int hf_tcap_AUDT_protocol_version_version1 = -1;
137 static int hf_tcap_AARQ_protocol_version_version1 = -1;
138 static int hf_tcap_AARE_protocol_version_version1 = -1;
140 /*--- End of included file: packet-tcap-hf.c ---*/
141 #line 62 "../../asn1/tcap/packet-tcap-template.c"
143 /* Initialize the subtree pointers */
144 static gint ett_tcap = -1;
145 static gint ett_param = -1;
147 static gint ett_otid = -1;
148 static gint ett_dtid = -1;
149 gint ett_tcap_stat = -1;
151 static struct tcapsrt_info_t * gp_tcapsrt_info;
152 static gboolean tcap_subdissector_used=FALSE;
153 static dissector_handle_t requested_subdissector_handle = NULL;
155 static struct tcaphash_context_t * gp_tcap_context=NULL;
158 /*--- Included file: packet-tcap-ett.c ---*/
159 #line 1 "../../asn1/tcap/packet-tcap-ett.c"
160 static gint ett_tcap_ExternalPDU_U = -1;
161 static gint ett_tcap_TCMessage = -1;
162 static gint ett_tcap_Unidirectional = -1;
163 static gint ett_tcap_Begin = -1;
164 static gint ett_tcap_End = -1;
165 static gint ett_tcap_Continue = -1;
166 static gint ett_tcap_Abort = -1;
167 static gint ett_tcap_Reason = -1;
168 static gint ett_tcap_SEQUENCE_SIZE_1_MAX_OF_Component = -1;
169 static gint ett_tcap_Component = -1;
170 static gint ett_tcap_Invoke = -1;
171 static gint ett_tcap_ReturnResult = -1;
172 static gint ett_tcap_T_resultretres = -1;
173 static gint ett_tcap_ReturnError = -1;
174 static gint ett_tcap_Reject = -1;
175 static gint ett_tcap_T_invokeIDRej = -1;
176 static gint ett_tcap_T_problem = -1;
177 static gint ett_tcap_OPERATION = -1;
178 static gint ett_tcap_ERROR = -1;
179 static gint ett_tcap_ErrorCode = -1;
180 static gint ett_tcap_UniDialoguePDU = -1;
181 static gint ett_tcap_AUDT_apdu_U = -1;
182 static gint ett_tcap_AUDT_protocol_version = -1;
183 static gint ett_tcap_AUDT_user_information = -1;
184 static gint ett_tcap_DialoguePDU = -1;
185 static gint ett_tcap_AARQ_apdu_U = -1;
186 static gint ett_tcap_AARQ_protocol_version = -1;
187 static gint ett_tcap_AARQ_user_information = -1;
188 static gint ett_tcap_AARE_apdu_U = -1;
189 static gint ett_tcap_AARE_protocol_version = -1;
190 static gint ett_tcap_AARE_user_information = -1;
191 static gint ett_tcap_ABRT_apdu_U = -1;
192 static gint ett_tcap_ABRT_user_information = -1;
193 static gint ett_tcap_Associate_source_diagnostic = -1;
195 /*--- End of included file: packet-tcap-ett.c ---*/
196 #line 78 "../../asn1/tcap/packet-tcap-template.c"
198 #define MAX_SSN 254
199 static range_t *global_ssn_range;
200 static range_t *ssn_range;
201 struct tcap_private_t tcap_private;
203 gboolean gtcap_HandleSRT=FALSE;
204 extern gboolean gtcap_PersistentSRT;
205 extern gboolean gtcap_DisplaySRT;
206 extern guint gtcap_RepetitionTimeout;
207 extern guint gtcap_LostTimeout;
209 static dissector_handle_t tcap_handle = NULL;
210 static dissector_table_t ber_oid_dissector_table;
211 static const char * cur_oid;
212 static const char * tcapext_oid;
213 static proto_tree * tcap_top_tree=NULL;
214 static proto_tree * tcap_stat_tree=NULL;
216 static dissector_handle_t data_handle;
217 static dissector_handle_t ansi_tcap_handle;
219 static void raz_tcap_private(struct tcap_private_t * p_tcap_private);
220 static int dissect_tcap_param(asn1_ctx_t *actx, proto_tree *tree, tvbuff_t *tvb, int offset);
221 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 static GHashTable* ansi_sub_dissectors = NULL;
224 static GHashTable* itu_sub_dissectors = NULL;
226 static void dissect_tcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree);
228 extern void add_ansi_tcap_subdissector(guint32 ssn, dissector_handle_t dissector) {
229 g_hash_table_insert(ansi_sub_dissectors,GUINT_TO_POINTER(ssn),dissector);
230 dissector_add_uint("sccp.ssn",ssn,tcap_handle);
233 extern void add_itu_tcap_subdissector(guint32 ssn, dissector_handle_t dissector) {
234 g_hash_table_insert(itu_sub_dissectors,GUINT_TO_POINTER(ssn),dissector);
235 dissector_add_uint("sccp.ssn",ssn,tcap_handle);
238 extern void delete_ansi_tcap_subdissector(guint32 ssn, dissector_handle_t dissector _U_) {
239 g_hash_table_remove(ansi_sub_dissectors,GUINT_TO_POINTER(ssn));
240 if (!get_itu_tcap_subdissector(ssn))
241 dissector_delete_uint("sccp.ssn",ssn,tcap_handle);
243 extern void delete_itu_tcap_subdissector(guint32 ssn, dissector_handle_t dissector _U_) {
244 g_hash_table_remove(itu_sub_dissectors,GUINT_TO_POINTER(ssn));
245 if (!get_ansi_tcap_subdissector(ssn))
246 dissector_delete_uint("sccp.ssn", ssn,tcap_handle);
249 dissector_handle_t get_ansi_tcap_subdissector(guint32 ssn) {
250 return (dissector_handle_t)g_hash_table_lookup(ansi_sub_dissectors,GUINT_TO_POINTER(ssn));
253 dissector_handle_t get_itu_tcap_subdissector(guint32 ssn) {
254 return (dissector_handle_t)g_hash_table_lookup(itu_sub_dissectors,GUINT_TO_POINTER(ssn));
260 /*--- Included file: packet-tcap-fn.c ---*/
261 #line 1 "../../asn1/tcap/packet-tcap-fn.c"
264 static int
265 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_) {
266 offset = dissect_ber_object_identifier(implicit_tag, actx, tree, tvb, offset, hf_index, NULL);
268 return offset;
273 static int
274 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_) {
275 #line 69 "../../asn1/tcap/tcap.cnf"
277 offset = dissect_tcap_DialoguePDU(TRUE, tvb, offset, actx, tree, -1);
281 return offset;
285 static const ber_sequence_t ExternalPDU_U_sequence[] = {
286 { &hf_tcap_oid , BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_tcap_OBJECT_IDENTIFIER },
287 { &hf_tcap_dialog , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_tcap_Dialog1 },
288 { NULL, 0, 0, 0, NULL }
291 static int
292 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_) {
293 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
294 ExternalPDU_U_sequence, hf_index, ett_tcap_ExternalPDU_U);
296 return offset;
301 static int
302 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_) {
303 #line 64 "../../asn1/tcap/tcap.cnf"
305 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
306 hf_index, BER_CLASS_UNI, 8, TRUE, dissect_tcap_ExternalPDU_U);
311 return offset;
316 static int
317 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_) {
318 #line 59 "../../asn1/tcap/tcap.cnf"
320 offset = dissect_tcap_ExternalPDU(FALSE /*implicit_tag*/, tvb, offset, actx, tree, -1);
324 return offset;
329 static int
330 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_) {
331 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
332 hf_index, BER_CLASS_APP, 11, TRUE, dissect_tcap_DialogueOC);
334 return offset;
339 static int
340 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_) {
341 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
342 NULL);
344 return offset;
349 static int
350 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_) {
351 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
352 NULL);
354 return offset;
358 static const value_string tcap_OPERATION_vals[] = {
359 { 0, "localValue" },
360 { 1, "globalValue" },
361 { 0, NULL }
364 static const ber_choice_t OPERATION_choice[] = {
365 { 0, &hf_tcap_localValue , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_tcap_INTEGER },
366 { 1, &hf_tcap_globalValue , BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_tcap_OBJECT_IDENTIFIER },
367 { 0, NULL, 0, 0, 0, NULL }
370 static int
371 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_) {
372 offset = dissect_ber_choice(actx, tree, tvb, offset,
373 OPERATION_choice, hf_index, ett_tcap_OPERATION,
374 NULL);
376 return offset;
381 static int
382 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_) {
383 #line 74 "../../asn1/tcap/tcap.cnf"
385 offset = dissect_tcap_param(actx,tree,tvb,offset);
389 return offset;
393 static const ber_sequence_t Invoke_sequence[] = {
394 { &hf_tcap_invokeID , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_tcap_InvokeIdType },
395 { &hf_tcap_linkedID , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_tcap_InvokeIdType },
396 { &hf_tcap_opCode , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_tcap_OPERATION },
397 { &hf_tcap_parameter , BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_tcap_Parameter },
398 { NULL, 0, 0, 0, NULL }
401 static int
402 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_) {
403 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
404 Invoke_sequence, hf_index, ett_tcap_Invoke);
406 return offset;
410 static const ber_sequence_t T_resultretres_sequence[] = {
411 { &hf_tcap_opCode , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_tcap_OPERATION },
412 { &hf_tcap_parameter , BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_tcap_Parameter },
413 { NULL, 0, 0, 0, NULL }
416 static int
417 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_) {
418 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
419 T_resultretres_sequence, hf_index, ett_tcap_T_resultretres);
421 return offset;
425 static const ber_sequence_t ReturnResult_sequence[] = {
426 { &hf_tcap_invokeID , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_tcap_InvokeIdType },
427 { &hf_tcap_resultretres , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_tcap_T_resultretres },
428 { NULL, 0, 0, 0, NULL }
431 static int
432 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_) {
433 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
434 ReturnResult_sequence, hf_index, ett_tcap_ReturnResult);
436 return offset;
441 static int
442 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_) {
443 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
444 NULL);
446 return offset;
450 static const value_string tcap_ErrorCode_vals[] = {
451 { 19, "nationaler" },
452 { 20, "privateer" },
453 { 0, NULL }
456 static const ber_choice_t ErrorCode_choice[] = {
457 { 19, &hf_tcap_nationaler , BER_CLASS_PRI, 19, BER_FLAGS_IMPLTAG, dissect_tcap_INTEGER_M32768_32767 },
458 { 20, &hf_tcap_privateer , BER_CLASS_PRI, 20, BER_FLAGS_IMPLTAG, dissect_tcap_INTEGER },
459 { 0, NULL, 0, 0, 0, NULL }
462 static int
463 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_) {
464 offset = dissect_ber_choice(actx, tree, tvb, offset,
465 ErrorCode_choice, hf_index, ett_tcap_ErrorCode,
466 NULL);
468 return offset;
472 static const ber_sequence_t ReturnError_sequence[] = {
473 { &hf_tcap_invokeID , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_tcap_InvokeIdType },
474 { &hf_tcap_errorCode , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_tcap_ErrorCode },
475 { &hf_tcap_parameter , BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_tcap_Parameter },
476 { NULL, 0, 0, 0, NULL }
479 static int
480 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_) {
481 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
482 ReturnError_sequence, hf_index, ett_tcap_ReturnError);
484 return offset;
489 static int
490 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_) {
491 offset = dissect_ber_null(implicit_tag, actx, tree, tvb, offset, hf_index);
493 return offset;
497 static const value_string tcap_T_invokeIDRej_vals[] = {
498 { 0, "derivable" },
499 { 1, "not-derivable" },
500 { 0, NULL }
503 static const ber_choice_t T_invokeIDRej_choice[] = {
504 { 0, &hf_tcap_derivable , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_tcap_InvokeIdType },
505 { 1, &hf_tcap_not_derivable , BER_CLASS_UNI, BER_UNI_TAG_NULL, BER_FLAGS_NOOWNTAG, dissect_tcap_NULL },
506 { 0, NULL, 0, 0, 0, NULL }
509 static int
510 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_) {
511 offset = dissect_ber_choice(actx, tree, tvb, offset,
512 T_invokeIDRej_choice, hf_index, ett_tcap_T_invokeIDRej,
513 NULL);
515 return offset;
519 static const value_string tcap_GeneralProblem_vals[] = {
520 { 0, "unrecognizedComponent" },
521 { 1, "mistypedComponent" },
522 { 2, "badlyStructuredComponent" },
523 { 0, NULL }
527 static int
528 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_) {
529 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
530 NULL);
532 return offset;
536 static const value_string tcap_InvokeProblem_vals[] = {
537 { 0, "duplicateInvokeID" },
538 { 1, "unrecognizedOperation" },
539 { 2, "mistypedParameter" },
540 { 3, "resourceLimitation" },
541 { 4, "initiatingRelease" },
542 { 5, "unrecognizedLinkedID" },
543 { 6, "linkedResponseUnexpected" },
544 { 7, "unexpectedLinkedOperation" },
545 { 0, NULL }
549 static int
550 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_) {
551 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
552 NULL);
554 return offset;
558 static const value_string tcap_ReturnResultProblem_vals[] = {
559 { 0, "unrecognizedInvokeID" },
560 { 1, "returnResultUnexpected" },
561 { 2, "mistypedParameter" },
562 { 0, NULL }
566 static int
567 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_) {
568 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
569 NULL);
571 return offset;
575 static const value_string tcap_ReturnErrorProblem_vals[] = {
576 { 0, "unrecognizedInvokeID" },
577 { 1, "returnErrorUnexpected" },
578 { 2, "unrecognizedError" },
579 { 3, "unexpectedError" },
580 { 4, "mistypedParameter" },
581 { 0, NULL }
585 static int
586 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_) {
587 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
588 NULL);
590 return offset;
594 static const value_string tcap_T_problem_vals[] = {
595 { 0, "generalProblem" },
596 { 1, "invokeProblem" },
597 { 2, "returnResultProblem" },
598 { 3, "returnErrorProblem" },
599 { 0, NULL }
602 static const ber_choice_t T_problem_choice[] = {
603 { 0, &hf_tcap_generalProblem , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_tcap_GeneralProblem },
604 { 1, &hf_tcap_invokeProblem , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_tcap_InvokeProblem },
605 { 2, &hf_tcap_returnResultProblem, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_tcap_ReturnResultProblem },
606 { 3, &hf_tcap_returnErrorProblem, BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_tcap_ReturnErrorProblem },
607 { 0, NULL, 0, 0, 0, NULL }
610 static int
611 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_) {
612 offset = dissect_ber_choice(actx, tree, tvb, offset,
613 T_problem_choice, hf_index, ett_tcap_T_problem,
614 NULL);
616 return offset;
620 static const ber_sequence_t Reject_sequence[] = {
621 { &hf_tcap_invokeIDRej , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_tcap_T_invokeIDRej },
622 { &hf_tcap_problem , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_tcap_T_problem },
623 { NULL, 0, 0, 0, NULL }
626 static int
627 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_) {
628 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
629 Reject_sequence, hf_index, ett_tcap_Reject);
631 return offset;
635 static const value_string tcap_Component_vals[] = {
636 { 1, "invoke" },
637 { 2, "returnResultLast" },
638 { 3, "returnError" },
639 { 4, "reject" },
640 { 7, "returnResultNotLast" },
641 { 0, NULL }
644 static const ber_choice_t Component_choice[] = {
645 { 1, &hf_tcap_invoke , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_tcap_Invoke },
646 { 2, &hf_tcap_returnResultLast, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_tcap_ReturnResult },
647 { 3, &hf_tcap_returnError , BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_tcap_ReturnError },
648 { 4, &hf_tcap_reject , BER_CLASS_CON, 4, BER_FLAGS_IMPLTAG, dissect_tcap_Reject },
649 { 7, &hf_tcap_returnResultNotLast, BER_CLASS_CON, 7, BER_FLAGS_IMPLTAG, dissect_tcap_ReturnResult },
650 { 0, NULL, 0, 0, 0, NULL }
653 static int
654 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_) {
655 #line 79 "../../asn1/tcap/tcap.cnf"
656 tvbuff_t *next_tvb;
657 gint8 ber_class;
658 gboolean pc;
659 gint tag;
660 guint32 len, comp_offset;
661 gint ind_field;
663 comp_offset = dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &ber_class, &pc, &tag);
664 comp_offset = dissect_ber_length(actx->pinfo, tree, tvb, comp_offset, &len, &ind_field);
665 /* we can believe the length now */
666 next_tvb = tvb_new_subset(tvb, offset, len+comp_offset-offset, len+comp_offset-offset);
668 if (!next_tvb)
669 return comp_offset;
671 TRY {
672 offset = dissect_ber_choice(actx, tree, tvb, offset,
673 Component_choice, hf_index, ett_tcap_Component,
674 NULL);
677 CATCH_NONFATAL_ERRORS {
678 show_exception(tvb, actx->pinfo, tree, EXCEPT_CODE, GET_MESSAGE);
680 ENDTRY;
682 dissect_tcap_ITU_ComponentPDU(implicit_tag, next_tvb, 0, actx, tcap_top_tree, hf_index);
684 /* return comp_offset+len; or return offset (will be automatically added) */
688 return offset;
692 static const ber_sequence_t SEQUENCE_SIZE_1_MAX_OF_Component_sequence_of[1] = {
693 { &hf_tcap__untag_item , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_tcap_Component },
696 static int
697 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_) {
698 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
699 SEQUENCE_SIZE_1_MAX_OF_Component_sequence_of, hf_index, ett_tcap_SEQUENCE_SIZE_1_MAX_OF_Component);
701 return offset;
706 static int
707 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_) {
708 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
709 hf_index, BER_CLASS_APP, 12, TRUE, dissect_tcap_SEQUENCE_SIZE_1_MAX_OF_Component);
711 return offset;
715 static const ber_sequence_t Unidirectional_sequence[] = {
716 { &hf_tcap_dialoguePortion, BER_CLASS_APP, 11, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_tcap_DialoguePortion },
717 { &hf_tcap_components , BER_CLASS_APP, 12, BER_FLAGS_NOOWNTAG, dissect_tcap_ComponentPortion },
718 { NULL, 0, 0, 0, NULL }
721 static int
722 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_) {
723 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
724 Unidirectional_sequence, hf_index, ett_tcap_Unidirectional);
726 return offset;
731 static int
732 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_) {
733 offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
734 NULL);
736 return offset;
741 static int
742 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_) {
743 #line 123 "../../asn1/tcap/tcap.cnf"
744 tvbuff_t *parameter_tvb;
745 guint8 len, i;
746 proto_item *tid_item;
747 proto_tree *subtree;
748 tid_item = proto_tree_add_text(tree, tvb, offset, -1, "Source Transaction ID");
749 subtree = proto_item_add_subtree(tid_item, ett_otid);
751 dissect_ber_octet_string(implicit_tag, actx, subtree, tvb, offset, hf_tcap_tid, NULL);
752 PROTO_ITEM_SET_HIDDEN(actx->created_item);
753 offset = dissect_ber_octet_string(implicit_tag, actx, subtree, tvb, offset, hf_tcap_otid,
754 &parameter_tvb);
756 if (parameter_tvb){
757 len = tvb_length_remaining(parameter_tvb, 0);
758 switch(len) {
759 case 1:
760 gp_tcapsrt_info->src_tid=tvb_get_guint8(parameter_tvb, 0);
761 break;
762 case 2:
763 gp_tcapsrt_info->src_tid=tvb_get_ntohs(parameter_tvb, 0);
764 break;
765 case 4:
766 gp_tcapsrt_info->src_tid=tvb_get_ntohl(parameter_tvb, 0);
767 break;
768 default:
769 gp_tcapsrt_info->src_tid=0;
770 break;
773 if (len){
774 col_append_str(actx->pinfo->cinfo, COL_INFO, "otid(");
775 for(i=0;i<len;i++)
776 col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%02x",tvb_get_guint8(parameter_tvb,i));
777 col_append_str(actx->pinfo->cinfo, COL_INFO, ") ");
785 return offset;
789 static const ber_sequence_t Begin_sequence[] = {
790 { &hf_tcap_otid , BER_CLASS_APP, 8, BER_FLAGS_NOOWNTAG, dissect_tcap_OrigTransactionID },
791 { &hf_tcap_dialoguePortion, BER_CLASS_APP, 11, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_tcap_DialoguePortion },
792 { &hf_tcap_components , BER_CLASS_APP, 12, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_tcap_ComponentPortion },
793 { NULL, 0, 0, 0, NULL }
796 static int
797 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_) {
798 #line 201 "../../asn1/tcap/tcap.cnf"
799 gp_tcapsrt_info->ope=TC_BEGIN;
801 /* Do not change col_add_str() to col_append_str() here: we _want_ this call
802 * to overwrite whatever's currently in the INFO column (e.g., "UDT" from
803 * the SCCP dissector).
805 * If there's something there that should not be overwritten, whoever
806 * put that info there should call col_set_fence() to protect it.
808 col_set_str(actx->pinfo->cinfo, COL_INFO, "Begin ");
810 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
811 Begin_sequence, hf_index, ett_tcap_Begin);
813 return offset;
818 static int
819 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_) {
820 #line 164 "../../asn1/tcap/tcap.cnf"
821 tvbuff_t *parameter_tvb;
822 guint8 len , i;
823 proto_item *tid_item;
824 proto_tree *subtree;
825 tid_item = proto_tree_add_text(tree, tvb, offset, -1, "Destination Transaction ID");
826 subtree = proto_item_add_subtree(tid_item, ett_dtid);
828 dissect_ber_octet_string(implicit_tag, actx, subtree, tvb, offset, hf_tcap_tid, NULL);
829 PROTO_ITEM_SET_HIDDEN(actx->created_item);
830 offset = dissect_ber_octet_string(implicit_tag, actx, subtree, tvb, offset, hf_tcap_dtid,
831 &parameter_tvb);
833 if (parameter_tvb){
834 len = tvb_length_remaining(parameter_tvb, 0);
835 switch(len) {
836 case 1:
837 gp_tcapsrt_info->dst_tid=tvb_get_guint8(parameter_tvb, 0);
838 break;
839 case 2:
840 gp_tcapsrt_info->dst_tid=tvb_get_ntohs(parameter_tvb, 0);
841 break;
842 case 4:
843 gp_tcapsrt_info->dst_tid=tvb_get_ntohl(parameter_tvb, 0);
844 break;
845 default:
846 gp_tcapsrt_info->dst_tid=0;
847 break;
850 if (len){
851 col_append_str(actx->pinfo->cinfo, COL_INFO, "dtid(");
852 for(i=0;i<len;i++)
853 col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%02x",tvb_get_guint8(parameter_tvb,i));
854 col_append_str(actx->pinfo->cinfo, COL_INFO, ") ");
859 return offset;
863 static const ber_sequence_t End_sequence[] = {
864 { &hf_tcap_dtid , BER_CLASS_APP, 9, BER_FLAGS_NOOWNTAG, dissect_tcap_DestTransactionID },
865 { &hf_tcap_dialoguePortion, BER_CLASS_APP, 11, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_tcap_DialoguePortion },
866 { &hf_tcap_components , BER_CLASS_APP, 12, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_tcap_ComponentPortion },
867 { NULL, 0, 0, 0, NULL }
870 static int
871 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_) {
872 #line 215 "../../asn1/tcap/tcap.cnf"
873 gp_tcapsrt_info->ope=TC_END;
875 col_set_str(actx->pinfo->cinfo, COL_INFO, "End ");
877 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
878 End_sequence, hf_index, ett_tcap_End);
880 return offset;
884 static const ber_sequence_t Continue_sequence[] = {
885 { &hf_tcap_otid , BER_CLASS_APP, 8, BER_FLAGS_NOOWNTAG, dissect_tcap_OrigTransactionID },
886 { &hf_tcap_dtid , BER_CLASS_APP, 9, BER_FLAGS_NOOWNTAG, dissect_tcap_DestTransactionID },
887 { &hf_tcap_dialoguePortion, BER_CLASS_APP, 11, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_tcap_DialoguePortion },
888 { &hf_tcap_components , BER_CLASS_APP, 12, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_tcap_ComponentPortion },
889 { NULL, 0, 0, 0, NULL }
892 static int
893 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_) {
894 #line 222 "../../asn1/tcap/tcap.cnf"
895 gp_tcapsrt_info->ope=TC_CONT;
897 col_set_str(actx->pinfo->cinfo, COL_INFO, "Continue ");
899 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
900 Continue_sequence, hf_index, ett_tcap_Continue);
902 return offset;
906 static const value_string tcap_P_AbortCause_U_vals[] = {
907 { 0, "unrecognizedMessageType" },
908 { 1, "unrecognizedTransactionID" },
909 { 2, "badlyFormattedTransactionPortion" },
910 { 3, "incorrectTransactionPortion" },
911 { 4, "resourceLimitation" },
912 { 0, NULL }
916 static int
917 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_) {
918 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
919 NULL);
921 return offset;
926 static int
927 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_) {
928 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
929 hf_index, BER_CLASS_APP, 10, TRUE, dissect_tcap_P_AbortCause_U);
931 return offset;
935 static const value_string tcap_Reason_vals[] = {
936 { 10, "p-abortCause" },
937 { 11, "u-abortCause" },
938 { 0, NULL }
941 static const ber_choice_t Reason_choice[] = {
942 { 10, &hf_tcap_p_abortCause , BER_CLASS_APP, 10, BER_FLAGS_NOOWNTAG, dissect_tcap_P_AbortCause },
943 { 11, &hf_tcap_u_abortCause , BER_CLASS_APP, 11, BER_FLAGS_NOOWNTAG, dissect_tcap_DialoguePortion },
944 { 0, NULL, 0, 0, 0, NULL }
947 static int
948 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_) {
949 offset = dissect_ber_choice(actx, tree, tvb, offset,
950 Reason_choice, hf_index, ett_tcap_Reason,
951 NULL);
953 return offset;
957 static const ber_sequence_t Abort_sequence[] = {
958 { &hf_tcap_dtid , BER_CLASS_APP, 9, BER_FLAGS_NOOWNTAG, dissect_tcap_DestTransactionID },
959 { &hf_tcap_reason , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_tcap_Reason },
960 { NULL, 0, 0, 0, NULL }
963 static int
964 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_) {
965 #line 229 "../../asn1/tcap/tcap.cnf"
966 gp_tcapsrt_info->ope=TC_ABORT;
968 col_set_str(actx->pinfo->cinfo, COL_INFO, "Abort ");
970 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
971 Abort_sequence, hf_index, ett_tcap_Abort);
973 return offset;
977 static const value_string tcap_TCMessage_vals[] = {
978 { 1, "unidirectional" },
979 { 2, "begin" },
980 { 4, "end" },
981 { 5, "continue" },
982 { 7, "abort" },
983 { 0, NULL }
986 static const ber_choice_t TCMessage_choice[] = {
987 { 1, &hf_tcap_unidirectional , BER_CLASS_APP, 1, BER_FLAGS_IMPLTAG, dissect_tcap_Unidirectional },
988 { 2, &hf_tcap_begin , BER_CLASS_APP, 2, BER_FLAGS_IMPLTAG, dissect_tcap_Begin },
989 { 4, &hf_tcap_end , BER_CLASS_APP, 4, BER_FLAGS_IMPLTAG, dissect_tcap_End },
990 { 5, &hf_tcap_continue , BER_CLASS_APP, 5, BER_FLAGS_IMPLTAG, dissect_tcap_Continue },
991 { 7, &hf_tcap_abort , BER_CLASS_APP, 7, BER_FLAGS_IMPLTAG, dissect_tcap_Abort },
992 { 0, NULL, 0, 0, 0, NULL }
995 static int
996 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_) {
997 offset = dissect_ber_choice(actx, tree, tvb, offset,
998 TCMessage_choice, hf_index, ett_tcap_TCMessage,
999 NULL);
1001 return offset;
1005 static const value_string tcap_ERROR_vals[] = {
1006 { 0, "localValue" },
1007 { 1, "globalValue" },
1008 { 0, NULL }
1011 static const ber_choice_t ERROR_choice[] = {
1012 { 0, &hf_tcap_localValue , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_tcap_INTEGER },
1013 { 1, &hf_tcap_globalValue , BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_tcap_OBJECT_IDENTIFIER },
1014 { 0, NULL, 0, 0, 0, NULL }
1017 static int
1018 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_) {
1019 offset = dissect_ber_choice(actx, tree, tvb, offset,
1020 ERROR_choice, hf_index, ett_tcap_ERROR,
1021 NULL);
1023 return offset;
1027 static const asn_namedbit AUDT_protocol_version_bits[] = {
1028 { 0, &hf_tcap_AUDT_protocol_version_version1, -1, -1, "version1", NULL },
1029 { 0, NULL, 0, 0, NULL, NULL }
1032 static int
1033 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_) {
1034 offset = dissect_ber_bitstring(implicit_tag, actx, tree, tvb, offset,
1035 AUDT_protocol_version_bits, hf_index, ett_tcap_AUDT_protocol_version,
1036 NULL);
1038 return offset;
1043 static int
1044 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_) {
1045 #line 108 "../../asn1/tcap/tcap.cnf"
1046 offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &cur_oid);
1048 tcap_private.oid= (void*) cur_oid;
1049 tcap_private.acv=TRUE;
1052 return offset;
1057 static int
1058 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_) {
1059 offset = dissect_ber_external_type(implicit_tag, tree, tvb, offset, actx, hf_index, NULL);
1061 return offset;
1065 static const ber_sequence_t AUDT_user_information_sequence_of[1] = {
1066 { &hf_tcap_audt_user_information_item, BER_CLASS_UNI, BER_UNI_TAG_EXTERNAL, BER_FLAGS_NOOWNTAG, dissect_tcap_EXTERNAL },
1069 static int
1070 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_) {
1071 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
1072 AUDT_user_information_sequence_of, hf_index, ett_tcap_AUDT_user_information);
1074 return offset;
1078 static const ber_sequence_t AUDT_apdu_U_sequence[] = {
1079 { &hf_tcap_audt_protocol_version, BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_tcap_AUDT_protocol_version },
1080 { &hf_tcap_audt_application_context_name, BER_CLASS_CON, 1, 0, dissect_tcap_AUDT_application_context_name },
1081 { &hf_tcap_audt_user_information, BER_CLASS_CON, 30, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_tcap_AUDT_user_information },
1082 { NULL, 0, 0, 0, NULL }
1085 static int
1086 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_) {
1087 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
1088 AUDT_apdu_U_sequence, hf_index, ett_tcap_AUDT_apdu_U);
1090 return offset;
1095 static int
1096 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_) {
1097 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
1098 hf_index, BER_CLASS_APP, 0, TRUE, dissect_tcap_AUDT_apdu_U);
1100 return offset;
1104 const value_string tcap_UniDialoguePDU_vals[] = {
1105 { 0, "unidialoguePDU" },
1106 { 0, NULL }
1109 static const ber_choice_t UniDialoguePDU_choice[] = {
1110 { 0, &hf_tcap_unidialoguePDU , BER_CLASS_APP, 0, BER_FLAGS_NOOWNTAG, dissect_tcap_AUDT_apdu },
1111 { 0, NULL, 0, 0, 0, NULL }
1115 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_) {
1116 offset = dissect_ber_choice(actx, tree, tvb, offset,
1117 UniDialoguePDU_choice, hf_index, ett_tcap_UniDialoguePDU,
1118 NULL);
1120 return offset;
1124 static const asn_namedbit AARQ_protocol_version_bits[] = {
1125 { 0, &hf_tcap_AARQ_protocol_version_version1, -1, -1, "version1", NULL },
1126 { 0, NULL, 0, 0, NULL, NULL }
1129 static int
1130 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_) {
1131 offset = dissect_ber_bitstring(implicit_tag, actx, tree, tvb, offset,
1132 AARQ_protocol_version_bits, hf_index, ett_tcap_AARQ_protocol_version,
1133 NULL);
1135 return offset;
1140 static int
1141 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_) {
1142 #line 113 "../../asn1/tcap/tcap.cnf"
1143 offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &cur_oid);
1145 tcap_private.oid= (void*) cur_oid;
1146 tcap_private.acv=TRUE;
1149 return offset;
1153 static const ber_sequence_t AARQ_user_information_sequence_of[1] = {
1154 { &hf_tcap_aarq_user_information_item, BER_CLASS_UNI, BER_UNI_TAG_EXTERNAL, BER_FLAGS_NOOWNTAG, dissect_tcap_EXTERNAL },
1157 static int
1158 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_) {
1159 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
1160 AARQ_user_information_sequence_of, hf_index, ett_tcap_AARQ_user_information);
1162 return offset;
1166 static const ber_sequence_t AARQ_apdu_U_sequence[] = {
1167 { &hf_tcap_aarq_protocol_version, BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_tcap_AARQ_protocol_version },
1168 { &hf_tcap_aarq_application_context_name, BER_CLASS_CON, 1, 0, dissect_tcap_AARQ_application_context_name },
1169 { &hf_tcap_aarq_user_information, BER_CLASS_CON, 30, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_tcap_AARQ_user_information },
1170 { NULL, 0, 0, 0, NULL }
1173 static int
1174 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_) {
1175 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
1176 AARQ_apdu_U_sequence, hf_index, ett_tcap_AARQ_apdu_U);
1178 return offset;
1183 static int
1184 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_) {
1185 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
1186 hf_index, BER_CLASS_APP, 0, TRUE, dissect_tcap_AARQ_apdu_U);
1188 return offset;
1192 static const asn_namedbit AARE_protocol_version_bits[] = {
1193 { 0, &hf_tcap_AARE_protocol_version_version1, -1, -1, "version1", NULL },
1194 { 0, NULL, 0, 0, NULL, NULL }
1197 static int
1198 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_) {
1199 offset = dissect_ber_bitstring(implicit_tag, actx, tree, tvb, offset,
1200 AARE_protocol_version_bits, hf_index, ett_tcap_AARE_protocol_version,
1201 NULL);
1203 return offset;
1208 static int
1209 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_) {
1210 #line 118 "../../asn1/tcap/tcap.cnf"
1211 offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &cur_oid);
1213 tcap_private.oid= (void*) cur_oid;
1214 tcap_private.acv=TRUE;
1217 return offset;
1221 static const value_string tcap_Associate_result_vals[] = {
1222 { 0, "accepted" },
1223 { 1, "reject-permanent" },
1224 { 0, NULL }
1228 static int
1229 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_) {
1230 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
1231 NULL);
1233 return offset;
1237 static const value_string tcap_T_dialogue_service_user_vals[] = {
1238 { 0, "null" },
1239 { 1, "no-reason-given" },
1240 { 2, "application-context-name-not-supported" },
1241 { 0, NULL }
1245 static int
1246 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_) {
1247 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
1248 NULL);
1250 return offset;
1254 static const value_string tcap_T_dialogue_service_provider_vals[] = {
1255 { 0, "null" },
1256 { 1, "no-reason-given" },
1257 { 2, "no-common-dialogue-portion" },
1258 { 0, NULL }
1262 static int
1263 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_) {
1264 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
1265 NULL);
1267 return offset;
1271 static const value_string tcap_Associate_source_diagnostic_vals[] = {
1272 { 1, "dialogue-service-user" },
1273 { 2, "dialogue-service-provider" },
1274 { 0, NULL }
1277 static const ber_choice_t Associate_source_diagnostic_choice[] = {
1278 { 1, &hf_tcap_dialogue_service_user, BER_CLASS_CON, 1, 0, dissect_tcap_T_dialogue_service_user },
1279 { 2, &hf_tcap_dialogue_service_provider, BER_CLASS_CON, 2, 0, dissect_tcap_T_dialogue_service_provider },
1280 { 0, NULL, 0, 0, 0, NULL }
1283 static int
1284 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_) {
1285 offset = dissect_ber_choice(actx, tree, tvb, offset,
1286 Associate_source_diagnostic_choice, hf_index, ett_tcap_Associate_source_diagnostic,
1287 NULL);
1289 return offset;
1293 static const ber_sequence_t AARE_user_information_sequence_of[1] = {
1294 { &hf_tcap_aare_user_information_item, BER_CLASS_UNI, BER_UNI_TAG_EXTERNAL, BER_FLAGS_NOOWNTAG, dissect_tcap_EXTERNAL },
1297 static int
1298 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_) {
1299 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
1300 AARE_user_information_sequence_of, hf_index, ett_tcap_AARE_user_information);
1302 return offset;
1306 static const ber_sequence_t AARE_apdu_U_sequence[] = {
1307 { &hf_tcap_aare_protocol_version, BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_tcap_AARE_protocol_version },
1308 { &hf_tcap_aare_application_context_name, BER_CLASS_CON, 1, 0, dissect_tcap_AARE_application_context_name },
1309 { &hf_tcap_result , BER_CLASS_CON, 2, 0, dissect_tcap_Associate_result },
1310 { &hf_tcap_result_source_diagnostic, BER_CLASS_CON, 3, BER_FLAGS_NOTCHKTAG, dissect_tcap_Associate_source_diagnostic },
1311 { &hf_tcap_aare_user_information, BER_CLASS_CON, 30, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_tcap_AARE_user_information },
1312 { NULL, 0, 0, 0, NULL }
1315 static int
1316 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_) {
1317 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
1318 AARE_apdu_U_sequence, hf_index, ett_tcap_AARE_apdu_U);
1320 return offset;
1325 static int
1326 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_) {
1327 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
1328 hf_index, BER_CLASS_APP, 1, TRUE, dissect_tcap_AARE_apdu_U);
1330 return offset;
1334 static const value_string tcap_ABRT_source_vals[] = {
1335 { 0, "dialogue-service-user" },
1336 { 1, "dialogue-service-provider" },
1337 { 0, NULL }
1341 static int
1342 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_) {
1343 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
1344 NULL);
1346 return offset;
1350 static const ber_sequence_t ABRT_user_information_sequence_of[1] = {
1351 { &hf_tcap_abrt_user_information_item, BER_CLASS_UNI, BER_UNI_TAG_EXTERNAL, BER_FLAGS_NOOWNTAG, dissect_tcap_EXTERNAL },
1354 static int
1355 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_) {
1356 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
1357 ABRT_user_information_sequence_of, hf_index, ett_tcap_ABRT_user_information);
1359 return offset;
1363 static const ber_sequence_t ABRT_apdu_U_sequence[] = {
1364 { &hf_tcap_abort_source , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_tcap_ABRT_source },
1365 { &hf_tcap_abrt_user_information, BER_CLASS_CON, 30, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_tcap_ABRT_user_information },
1366 { NULL, 0, 0, 0, NULL }
1369 static int
1370 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_) {
1371 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
1372 ABRT_apdu_U_sequence, hf_index, ett_tcap_ABRT_apdu_U);
1374 return offset;
1379 static int
1380 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_) {
1381 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
1382 hf_index, BER_CLASS_APP, 4, TRUE, dissect_tcap_ABRT_apdu_U);
1384 return offset;
1388 const value_string tcap_DialoguePDU_vals[] = {
1389 { 0, "dialogueRequest" },
1390 { 1, "dialogueResponse" },
1391 { 4, "dialogueAbort" },
1392 { 0, NULL }
1395 static const ber_choice_t DialoguePDU_choice[] = {
1396 { 0, &hf_tcap_dialogueRequest, BER_CLASS_APP, 0, BER_FLAGS_NOOWNTAG, dissect_tcap_AARQ_apdu },
1397 { 1, &hf_tcap_dialogueResponse, BER_CLASS_APP, 1, BER_FLAGS_NOOWNTAG, dissect_tcap_AARE_apdu },
1398 { 4, &hf_tcap_dialogueAbort , BER_CLASS_APP, 4, BER_FLAGS_NOOWNTAG, dissect_tcap_ABRT_apdu },
1399 { 0, NULL, 0, 0, 0, NULL }
1403 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_) {
1404 offset = dissect_ber_choice(actx, tree, tvb, offset,
1405 DialoguePDU_choice, hf_index, ett_tcap_DialoguePDU,
1406 NULL);
1408 return offset;
1411 /*--- PDUs ---*/
1413 static void dissect_UniDialoguePDU_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_UniDialoguePDU(FALSE, tvb, 0, &asn1_ctx, tree, hf_tcap_UniDialoguePDU_PDU);
1418 static void dissect_DialoguePDU_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
1419 asn1_ctx_t asn1_ctx;
1420 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
1421 dissect_tcap_DialoguePDU(FALSE, tvb, 0, &asn1_ctx, tree, hf_tcap_DialoguePDU_PDU);
1425 /*--- End of included file: packet-tcap-fn.c ---*/
1426 #line 141 "../../asn1/tcap/packet-tcap-template.c"
1430 const value_string tcap_component_type_str[] = {
1431 { TCAP_COMP_INVOKE, "Invoke" },
1432 { TCAP_COMP_RRL, "Return Result(L)" },
1433 { TCAP_COMP_RE, "Return Error" },
1434 { TCAP_COMP_REJECT, "Reject" },
1435 { TCAP_COMP_RRN, "Return Result(NL)" },
1436 { 0, NULL } };
1439 static void
1440 dissect_tcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
1442 proto_item *item=NULL;
1443 proto_tree *tree=NULL;
1445 struct tcaphash_context_t * p_tcap_context;
1446 dissector_handle_t subdissector_handle;
1447 asn1_ctx_t asn1_ctx;
1448 gint8 ber_class;
1449 gboolean pc;
1450 gint tag;
1452 /* Check if ANSI TCAP and call the ANSI TCAP dissector if that's the case
1453 * PackageType ::= CHOICE { unidirectional [PRIVATE 1] IMPLICIT UniTransactionPDU,
1454 * queryWithPerm [PRIVATE 2] IMPLICIT TransactionPDU,
1455 * queryWithoutPerm [PRIVATE 3] IMPLICIT TransactionPDU,
1456 * response [PRIVATE 4] IMPLICIT TransactionPDU,
1457 * conversationWithPerm [PRIVATE 5] IMPLICIT TransactionPDU,
1458 * conversationWithoutPerm [PRIVATE 6] IMPLICIT TransactionPDU,
1459 * abort [PRIVATE 22] IMPLICIT Abort
1464 get_ber_identifier(tvb, 0, &ber_class, &pc, &tag);
1466 if(ber_class == BER_CLASS_PRI){
1467 switch(tag){
1468 case 1:
1469 case 2:
1470 case 3:
1471 case 4:
1472 case 5:
1473 case 6:
1474 case 22:
1475 call_dissector(ansi_tcap_handle, tvb, pinfo, parent_tree);
1476 return;
1477 break;
1478 default:
1479 return;
1483 /* ITU TCAP */
1484 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
1486 tcap_top_tree = parent_tree;
1487 tcap_stat_tree = NULL;
1489 col_set_str(pinfo->cinfo, COL_PROTOCOL, "TCAP");
1491 /* create display subtree for the protocol */
1492 if(parent_tree){
1493 item = proto_tree_add_item(parent_tree, proto_tcap, tvb, 0, -1, ENC_NA);
1494 tree = proto_item_add_subtree(item, ett_tcap);
1495 tcap_stat_tree=tree;
1497 cur_oid = NULL;
1498 tcapext_oid = NULL;
1499 raz_tcap_private(&tcap_private);
1501 asn1_ctx.value_ptr = &tcap_private;
1502 gp_tcapsrt_info=tcapsrt_razinfo();
1503 tcap_subdissector_used=FALSE;
1504 gp_tcap_context=NULL;
1505 dissect_tcap_TCMessage(FALSE, tvb, 0, &asn1_ctx, tree, -1);
1507 if (gtcap_HandleSRT && !tcap_subdissector_used ) {
1508 p_tcap_context=tcapsrt_call_matching(tvb, pinfo, tcap_stat_tree, gp_tcapsrt_info);
1509 tcap_private.context=p_tcap_context;
1511 /* If the current message is TCAP only,
1512 * save the Application Context Name for the next messages
1514 if ( p_tcap_context && cur_oid && !p_tcap_context->oid_present ) {
1515 /* Save the application context and the sub dissector */
1516 g_strlcpy(p_tcap_context->oid, cur_oid, sizeof(p_tcap_context->oid));
1517 p_tcap_context->oid_present=TRUE;
1518 if ( (subdissector_handle = dissector_get_string_handle(ber_oid_dissector_table, cur_oid)) ) {
1519 p_tcap_context->subdissector_handle=subdissector_handle;
1520 p_tcap_context->subdissector_present=TRUE;
1523 if (gtcap_HandleSRT && p_tcap_context && p_tcap_context->callback) {
1524 /* Callback fonction for the upper layer */
1525 (p_tcap_context->callback)(tvb, pinfo, tcap_stat_tree, p_tcap_context);
1530 void
1531 proto_reg_handoff_tcap(void)
1534 data_handle = find_dissector("data");
1535 ansi_tcap_handle = find_dissector("ansi_tcap");
1536 ber_oid_dissector_table = find_dissector_table("ber.oid");
1539 /*--- Included file: packet-tcap-dis-tab.c ---*/
1540 #line 1 "../../asn1/tcap/packet-tcap-dis-tab.c"
1541 register_ber_oid_dissector("0.0.17.773.1.1.1", dissect_DialoguePDU_PDU, proto_tcap, "id-as-dialogue");
1542 register_ber_oid_dissector("0.0.17.773.1.2.1", dissect_UniDialoguePDU_PDU, proto_tcap, "id-as-uniDialogue");
1545 /*--- End of included file: packet-tcap-dis-tab.c ---*/
1546 #line 253 "../../asn1/tcap/packet-tcap-template.c"
1549 static void init_tcap(void);
1551 void
1552 proto_register_tcap(void)
1555 /* Setup list of header fields See Section 1.6.1 for details*/
1556 static hf_register_info hf[] = {
1557 { &hf_tcap_tag,
1558 { "Tag", "tcap.msgtype",
1559 FT_UINT8, BASE_HEX, NULL, 0,
1560 NULL, HFILL }
1562 { &hf_tcap_length,
1563 { "Length", "tcap.len",
1564 FT_UINT8, BASE_DEC, NULL, 0,
1565 NULL, HFILL }
1567 { &hf_tcap_data,
1568 { "Data", "tcap.data",
1569 FT_BYTES, BASE_NONE, NULL, 0,
1570 NULL, HFILL }
1572 { &hf_tcap_tid,
1573 { "Transaction Id", "tcap.tid",
1574 FT_BYTES, BASE_NONE, NULL, 0,
1575 NULL, HFILL }
1577 /* Tcap Service Response Time */
1578 { &hf_tcapsrt_SessionId,
1579 { "Session Id",
1580 "tcap.srt.session_id",
1581 FT_UINT32, BASE_DEC, NULL, 0x0,
1582 NULL, HFILL }
1584 { &hf_tcapsrt_BeginSession,
1585 { "Begin Session",
1586 "tcap.srt.begin",
1587 FT_FRAMENUM, BASE_NONE, NULL, 0x0,
1588 "SRT Begin of Session", HFILL }
1590 { &hf_tcapsrt_EndSession,
1591 { "End Session",
1592 "tcap.srt.end",
1593 FT_FRAMENUM, BASE_NONE, NULL, 0x0,
1594 "SRT End of Session", HFILL }
1596 { &hf_tcapsrt_SessionTime,
1597 { "Session duration",
1598 "tcap.srt.sessiontime",
1599 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
1600 "Duration of the TCAP session", HFILL }
1602 { &hf_tcapsrt_Duplicate,
1603 { "Session Duplicate",
1604 "tcap.srt.duplicate",
1605 FT_FRAMENUM, BASE_NONE, NULL, 0x0,
1606 "SRT Duplicated with Session", HFILL }
1609 /*--- Included file: packet-tcap-hfarr.c ---*/
1610 #line 1 "../../asn1/tcap/packet-tcap-hfarr.c"
1611 { &hf_tcap_UniDialoguePDU_PDU,
1612 { "UniDialoguePDU", "tcap.UniDialoguePDU",
1613 FT_UINT32, BASE_DEC, VALS(tcap_UniDialoguePDU_vals), 0,
1614 NULL, HFILL }},
1615 { &hf_tcap_DialoguePDU_PDU,
1616 { "DialoguePDU", "tcap.DialoguePDU",
1617 FT_UINT32, BASE_DEC, VALS(tcap_DialoguePDU_vals), 0,
1618 NULL, HFILL }},
1619 { &hf_tcap_oid,
1620 { "oid", "tcap.oid",
1621 FT_OID, BASE_NONE, NULL, 0,
1622 "OBJECT_IDENTIFIER", HFILL }},
1623 { &hf_tcap_dialog,
1624 { "dialog", "tcap.dialog",
1625 FT_BYTES, BASE_NONE, NULL, 0,
1626 "Dialog1", HFILL }},
1627 { &hf_tcap_unidirectional,
1628 { "unidirectional", "tcap.unidirectional_element",
1629 FT_NONE, BASE_NONE, NULL, 0,
1630 NULL, HFILL }},
1631 { &hf_tcap_begin,
1632 { "begin", "tcap.begin_element",
1633 FT_NONE, BASE_NONE, NULL, 0,
1634 NULL, HFILL }},
1635 { &hf_tcap_end,
1636 { "end", "tcap.end_element",
1637 FT_NONE, BASE_NONE, NULL, 0,
1638 NULL, HFILL }},
1639 { &hf_tcap_continue,
1640 { "continue", "tcap.continue_element",
1641 FT_NONE, BASE_NONE, NULL, 0,
1642 NULL, HFILL }},
1643 { &hf_tcap_abort,
1644 { "abort", "tcap.abort_element",
1645 FT_NONE, BASE_NONE, NULL, 0,
1646 NULL, HFILL }},
1647 { &hf_tcap_dialoguePortion,
1648 { "dialoguePortion", "tcap.dialoguePortion",
1649 FT_BYTES, BASE_NONE, NULL, 0,
1650 NULL, HFILL }},
1651 { &hf_tcap_components,
1652 { "components", "tcap.components",
1653 FT_UINT32, BASE_DEC, NULL, 0,
1654 "ComponentPortion", HFILL }},
1655 { &hf_tcap_otid,
1656 { "otid", "tcap.otid",
1657 FT_BYTES, BASE_NONE, NULL, 0,
1658 "OrigTransactionID", HFILL }},
1659 { &hf_tcap_dtid,
1660 { "dtid", "tcap.dtid",
1661 FT_BYTES, BASE_NONE, NULL, 0,
1662 "DestTransactionID", HFILL }},
1663 { &hf_tcap_reason,
1664 { "reason", "tcap.reason",
1665 FT_UINT32, BASE_DEC, VALS(tcap_Reason_vals), 0,
1666 NULL, HFILL }},
1667 { &hf_tcap_p_abortCause,
1668 { "p-abortCause", "tcap.p_abortCause",
1669 FT_UINT32, BASE_DEC, VALS(tcap_P_AbortCause_U_vals), 0,
1670 NULL, HFILL }},
1671 { &hf_tcap_u_abortCause,
1672 { "u-abortCause", "tcap.u_abortCause",
1673 FT_BYTES, BASE_NONE, NULL, 0,
1674 "DialoguePortion", HFILL }},
1675 { &hf_tcap__untag_item,
1676 { "Component", "tcap.Component",
1677 FT_UINT32, BASE_DEC, VALS(tcap_Component_vals), 0,
1678 NULL, HFILL }},
1679 { &hf_tcap_invoke,
1680 { "invoke", "tcap.invoke_element",
1681 FT_NONE, BASE_NONE, NULL, 0,
1682 NULL, HFILL }},
1683 { &hf_tcap_returnResultLast,
1684 { "returnResultLast", "tcap.returnResultLast_element",
1685 FT_NONE, BASE_NONE, NULL, 0,
1686 "ReturnResult", HFILL }},
1687 { &hf_tcap_returnError,
1688 { "returnError", "tcap.returnError_element",
1689 FT_NONE, BASE_NONE, NULL, 0,
1690 NULL, HFILL }},
1691 { &hf_tcap_reject,
1692 { "reject", "tcap.reject_element",
1693 FT_NONE, BASE_NONE, NULL, 0,
1694 NULL, HFILL }},
1695 { &hf_tcap_returnResultNotLast,
1696 { "returnResultNotLast", "tcap.returnResultNotLast_element",
1697 FT_NONE, BASE_NONE, NULL, 0,
1698 "ReturnResult", HFILL }},
1699 { &hf_tcap_invokeID,
1700 { "invokeID", "tcap.invokeID",
1701 FT_INT32, BASE_DEC, NULL, 0,
1702 "InvokeIdType", HFILL }},
1703 { &hf_tcap_linkedID,
1704 { "linkedID", "tcap.linkedID",
1705 FT_INT32, BASE_DEC, NULL, 0,
1706 "InvokeIdType", HFILL }},
1707 { &hf_tcap_opCode,
1708 { "opCode", "tcap.opCode",
1709 FT_UINT32, BASE_DEC, VALS(tcap_OPERATION_vals), 0,
1710 "OPERATION", HFILL }},
1711 { &hf_tcap_parameter,
1712 { "parameter", "tcap.parameter_element",
1713 FT_NONE, BASE_NONE, NULL, 0,
1714 NULL, HFILL }},
1715 { &hf_tcap_resultretres,
1716 { "resultretres", "tcap.resultretres_element",
1717 FT_NONE, BASE_NONE, NULL, 0,
1718 NULL, HFILL }},
1719 { &hf_tcap_errorCode,
1720 { "errorCode", "tcap.errorCode",
1721 FT_UINT32, BASE_DEC, VALS(tcap_ErrorCode_vals), 0,
1722 NULL, HFILL }},
1723 { &hf_tcap_invokeIDRej,
1724 { "invokeIDRej", "tcap.invokeIDRej",
1725 FT_UINT32, BASE_DEC, VALS(tcap_T_invokeIDRej_vals), 0,
1726 NULL, HFILL }},
1727 { &hf_tcap_derivable,
1728 { "derivable", "tcap.derivable",
1729 FT_INT32, BASE_DEC, NULL, 0,
1730 "InvokeIdType", HFILL }},
1731 { &hf_tcap_not_derivable,
1732 { "not-derivable", "tcap.not_derivable_element",
1733 FT_NONE, BASE_NONE, NULL, 0,
1734 NULL, HFILL }},
1735 { &hf_tcap_problem,
1736 { "problem", "tcap.problem",
1737 FT_UINT32, BASE_DEC, VALS(tcap_T_problem_vals), 0,
1738 NULL, HFILL }},
1739 { &hf_tcap_generalProblem,
1740 { "generalProblem", "tcap.generalProblem",
1741 FT_INT32, BASE_DEC, VALS(tcap_GeneralProblem_vals), 0,
1742 NULL, HFILL }},
1743 { &hf_tcap_invokeProblem,
1744 { "invokeProblem", "tcap.invokeProblem",
1745 FT_INT32, BASE_DEC, VALS(tcap_InvokeProblem_vals), 0,
1746 NULL, HFILL }},
1747 { &hf_tcap_returnResultProblem,
1748 { "returnResultProblem", "tcap.returnResultProblem",
1749 FT_INT32, BASE_DEC, VALS(tcap_ReturnResultProblem_vals), 0,
1750 NULL, HFILL }},
1751 { &hf_tcap_returnErrorProblem,
1752 { "returnErrorProblem", "tcap.returnErrorProblem",
1753 FT_INT32, BASE_DEC, VALS(tcap_ReturnErrorProblem_vals), 0,
1754 NULL, HFILL }},
1755 { &hf_tcap_localValue,
1756 { "localValue", "tcap.localValue",
1757 FT_INT32, BASE_DEC, NULL, 0,
1758 "INTEGER", HFILL }},
1759 { &hf_tcap_globalValue,
1760 { "globalValue", "tcap.globalValue",
1761 FT_OID, BASE_NONE, NULL, 0,
1762 "OBJECT_IDENTIFIER", HFILL }},
1763 { &hf_tcap_nationaler,
1764 { "nationaler", "tcap.nationaler",
1765 FT_INT32, BASE_DEC, NULL, 0,
1766 "INTEGER_M32768_32767", HFILL }},
1767 { &hf_tcap_privateer,
1768 { "privateer", "tcap.privateer",
1769 FT_INT32, BASE_DEC, NULL, 0,
1770 "INTEGER", HFILL }},
1771 { &hf_tcap_unidialoguePDU,
1772 { "unidialoguePDU", "tcap.unidialoguePDU_element",
1773 FT_NONE, BASE_NONE, NULL, 0,
1774 "AUDT_apdu", HFILL }},
1775 { &hf_tcap_audt_protocol_version,
1776 { "protocol-version", "tcap.protocol_version",
1777 FT_BYTES, BASE_NONE, NULL, 0,
1778 "AUDT_protocol_version", HFILL }},
1779 { &hf_tcap_audt_application_context_name,
1780 { "application-context-name", "tcap.application_context_name",
1781 FT_OID, BASE_NONE, NULL, 0,
1782 "AUDT_application_context_name", HFILL }},
1783 { &hf_tcap_audt_user_information,
1784 { "user-information", "tcap.user_information",
1785 FT_UINT32, BASE_DEC, NULL, 0,
1786 "AUDT_user_information", HFILL }},
1787 { &hf_tcap_audt_user_information_item,
1788 { "user-information item", "tcap.user_information_item_element",
1789 FT_NONE, BASE_NONE, NULL, 0,
1790 "EXTERNAL", HFILL }},
1791 { &hf_tcap_dialogueRequest,
1792 { "dialogueRequest", "tcap.dialogueRequest_element",
1793 FT_NONE, BASE_NONE, NULL, 0,
1794 "AARQ_apdu", HFILL }},
1795 { &hf_tcap_dialogueResponse,
1796 { "dialogueResponse", "tcap.dialogueResponse_element",
1797 FT_NONE, BASE_NONE, NULL, 0,
1798 "AARE_apdu", HFILL }},
1799 { &hf_tcap_dialogueAbort,
1800 { "dialogueAbort", "tcap.dialogueAbort_element",
1801 FT_NONE, BASE_NONE, NULL, 0,
1802 "ABRT_apdu", HFILL }},
1803 { &hf_tcap_aarq_protocol_version,
1804 { "protocol-version", "tcap.protocol_version",
1805 FT_BYTES, BASE_NONE, NULL, 0,
1806 "AARQ_protocol_version", HFILL }},
1807 { &hf_tcap_aarq_application_context_name,
1808 { "application-context-name", "tcap.application_context_name",
1809 FT_OID, BASE_NONE, NULL, 0,
1810 "AARQ_application_context_name", HFILL }},
1811 { &hf_tcap_aarq_user_information,
1812 { "user-information", "tcap.user_information",
1813 FT_UINT32, BASE_DEC, NULL, 0,
1814 "AARQ_user_information", HFILL }},
1815 { &hf_tcap_aarq_user_information_item,
1816 { "user-information item", "tcap.user_information_item_element",
1817 FT_NONE, BASE_NONE, NULL, 0,
1818 "EXTERNAL", HFILL }},
1819 { &hf_tcap_aare_protocol_version,
1820 { "protocol-version", "tcap.protocol_version",
1821 FT_BYTES, BASE_NONE, NULL, 0,
1822 "AARE_protocol_version", HFILL }},
1823 { &hf_tcap_aare_application_context_name,
1824 { "application-context-name", "tcap.application_context_name",
1825 FT_OID, BASE_NONE, NULL, 0,
1826 "AARE_application_context_name", HFILL }},
1827 { &hf_tcap_result,
1828 { "result", "tcap.result",
1829 FT_INT32, BASE_DEC, VALS(tcap_Associate_result_vals), 0,
1830 "Associate_result", HFILL }},
1831 { &hf_tcap_result_source_diagnostic,
1832 { "result-source-diagnostic", "tcap.result_source_diagnostic",
1833 FT_UINT32, BASE_DEC, VALS(tcap_Associate_source_diagnostic_vals), 0,
1834 "Associate_source_diagnostic", HFILL }},
1835 { &hf_tcap_aare_user_information,
1836 { "user-information", "tcap.user_information",
1837 FT_UINT32, BASE_DEC, NULL, 0,
1838 "AARE_user_information", HFILL }},
1839 { &hf_tcap_aare_user_information_item,
1840 { "user-information item", "tcap.user_information_item_element",
1841 FT_NONE, BASE_NONE, NULL, 0,
1842 "EXTERNAL", HFILL }},
1843 { &hf_tcap_abort_source,
1844 { "abort-source", "tcap.abort_source",
1845 FT_INT32, BASE_DEC, VALS(tcap_ABRT_source_vals), 0,
1846 "ABRT_source", HFILL }},
1847 { &hf_tcap_abrt_user_information,
1848 { "user-information", "tcap.user_information",
1849 FT_UINT32, BASE_DEC, NULL, 0,
1850 "ABRT_user_information", HFILL }},
1851 { &hf_tcap_abrt_user_information_item,
1852 { "user-information item", "tcap.user_information_item_element",
1853 FT_NONE, BASE_NONE, NULL, 0,
1854 "EXTERNAL", HFILL }},
1855 { &hf_tcap_dialogue_service_user,
1856 { "dialogue-service-user", "tcap.dialogue_service_user",
1857 FT_INT32, BASE_DEC, VALS(tcap_T_dialogue_service_user_vals), 0,
1858 NULL, HFILL }},
1859 { &hf_tcap_dialogue_service_provider,
1860 { "dialogue-service-provider", "tcap.dialogue_service_provider",
1861 FT_INT32, BASE_DEC, VALS(tcap_T_dialogue_service_provider_vals), 0,
1862 NULL, HFILL }},
1863 { &hf_tcap_AUDT_protocol_version_version1,
1864 { "version1", "tcap.version1",
1865 FT_BOOLEAN, 8, NULL, 0x80,
1866 NULL, HFILL }},
1867 { &hf_tcap_AARQ_protocol_version_version1,
1868 { "version1", "tcap.version1",
1869 FT_BOOLEAN, 8, NULL, 0x80,
1870 NULL, HFILL }},
1871 { &hf_tcap_AARE_protocol_version_version1,
1872 { "version1", "tcap.version1",
1873 FT_BOOLEAN, 8, NULL, 0x80,
1874 NULL, HFILL }},
1876 /*--- End of included file: packet-tcap-hfarr.c ---*/
1877 #line 315 "../../asn1/tcap/packet-tcap-template.c"
1880 /* Setup protocol subtree array */
1881 static gint *ett[] = {
1882 &ett_tcap,
1883 &ett_param,
1884 &ett_otid,
1885 &ett_dtid,
1886 &ett_tcap_stat,
1888 /*--- Included file: packet-tcap-ettarr.c ---*/
1889 #line 1 "../../asn1/tcap/packet-tcap-ettarr.c"
1890 &ett_tcap_ExternalPDU_U,
1891 &ett_tcap_TCMessage,
1892 &ett_tcap_Unidirectional,
1893 &ett_tcap_Begin,
1894 &ett_tcap_End,
1895 &ett_tcap_Continue,
1896 &ett_tcap_Abort,
1897 &ett_tcap_Reason,
1898 &ett_tcap_SEQUENCE_SIZE_1_MAX_OF_Component,
1899 &ett_tcap_Component,
1900 &ett_tcap_Invoke,
1901 &ett_tcap_ReturnResult,
1902 &ett_tcap_T_resultretres,
1903 &ett_tcap_ReturnError,
1904 &ett_tcap_Reject,
1905 &ett_tcap_T_invokeIDRej,
1906 &ett_tcap_T_problem,
1907 &ett_tcap_OPERATION,
1908 &ett_tcap_ERROR,
1909 &ett_tcap_ErrorCode,
1910 &ett_tcap_UniDialoguePDU,
1911 &ett_tcap_AUDT_apdu_U,
1912 &ett_tcap_AUDT_protocol_version,
1913 &ett_tcap_AUDT_user_information,
1914 &ett_tcap_DialoguePDU,
1915 &ett_tcap_AARQ_apdu_U,
1916 &ett_tcap_AARQ_protocol_version,
1917 &ett_tcap_AARQ_user_information,
1918 &ett_tcap_AARE_apdu_U,
1919 &ett_tcap_AARE_protocol_version,
1920 &ett_tcap_AARE_user_information,
1921 &ett_tcap_ABRT_apdu_U,
1922 &ett_tcap_ABRT_user_information,
1923 &ett_tcap_Associate_source_diagnostic,
1925 /*--- End of included file: packet-tcap-ettarr.c ---*/
1926 #line 325 "../../asn1/tcap/packet-tcap-template.c"
1929 /*static enum_val_t tcap_options[] = {
1930 { "itu", "ITU", ITU_TCAP_STANDARD },
1931 { "ansi", "ANSI", ANSI_TCAP_STANDARD },
1932 { NULL, NULL, 0 }
1933 };*/
1935 module_t *tcap_module;
1937 /* Register the protocol name and description */
1938 proto_tcap = proto_register_protocol(PNAME, PSNAME, PFNAME);
1940 /* Required function calls to register the header fields and subtrees used */
1941 proto_register_field_array(proto_tcap, hf, array_length(hf));
1942 proto_register_subtree_array(ett, array_length(ett));
1944 tcap_module = prefs_register_protocol(proto_tcap, NULL);
1946 #if 0
1947 prefs_register_enum_preference(tcap_module, "standard", "ITU TCAP standard",
1948 "The SS7 standard used in ITU TCAP packets",
1949 &tcap_standard, tcap_options, FALSE);
1950 #else
1951 prefs_register_obsolete_preference(tcap_module, "standard");
1952 #endif
1954 #if 0
1955 prefs_register_bool_preference(tcap_module, "lock_info_col", "Lock Info column",
1956 "Always show TCAP in Info column",
1957 &lock_info_col);
1958 #else
1959 prefs_register_obsolete_preference(tcap_module, "lock_info_col");
1960 #endif
1962 /* Set default SSNs */
1963 range_convert_str(&global_ssn_range, "", MAX_SSN);
1964 ssn_range = range_empty();
1966 prefs_register_range_preference(tcap_module, "ssn", "SCCP SSNs",
1967 "SCCP (and SUA) SSNs to decode as TCAP",
1968 &global_ssn_range, MAX_SSN);
1970 prefs_register_bool_preference(tcap_module, "srt",
1971 "Service Response Time Analyse",
1972 "Activate the analyse for Response Time",
1973 &gtcap_HandleSRT);
1975 prefs_register_bool_preference(tcap_module, "persistentsrt",
1976 "Persistent stats for SRT",
1977 "Statistics for Response Time",
1978 &gtcap_PersistentSRT);
1980 prefs_register_uint_preference(tcap_module, "repetitiontimeout",
1981 "Repetition timeout",
1982 "Maximal delay for message repetion",
1983 10, &gtcap_RepetitionTimeout);
1985 prefs_register_uint_preference(tcap_module, "losttimeout",
1986 "lost timeout",
1987 "Maximal delay for message lost",
1988 10, &gtcap_LostTimeout);
1990 ansi_sub_dissectors = g_hash_table_new(g_direct_hash,g_direct_equal);
1991 itu_sub_dissectors = g_hash_table_new(g_direct_hash,g_direct_equal);
1993 /* 'globally' register dissector */
1994 register_dissector("tcap", dissect_tcap, proto_tcap);
1996 tcap_handle = create_dissector_handle(dissect_tcap, proto_tcap);
1998 register_init_routine(&init_tcap);
2002 static void range_delete_callback(guint32 ssn)
2004 if ( ssn && !get_ansi_tcap_subdissector(ssn) && !get_itu_tcap_subdissector(ssn) ) {
2005 dissector_delete_uint("sccp.ssn", ssn, tcap_handle);
2009 static void range_add_callback(guint32 ssn)
2011 if (ssn && !get_ansi_tcap_subdissector(ssn) && !get_itu_tcap_subdissector(ssn) ) {
2012 dissector_add_uint("sccp.ssn", ssn, tcap_handle);
2017 static void init_tcap(void) {
2018 if (ssn_range) {
2019 range_foreach(ssn_range, range_delete_callback);
2020 g_free(ssn_range);
2023 ssn_range = range_copy(global_ssn_range);
2024 range_foreach(ssn_range, range_add_callback);
2025 tcapsrt_init_routine();
2028 static int
2029 dissect_tcap_param(asn1_ctx_t *actx, proto_tree *tree, tvbuff_t *tvb, int offset)
2031 gint tag_offset, saved_offset, len_offset;
2032 tvbuff_t *next_tvb;
2033 proto_tree *subtree;
2034 proto_item *pi;
2035 gint8 ber_class;
2036 gboolean pc;
2037 gint32 tag;
2038 guint32 len;
2039 guint32 tag_length;
2040 guint32 len_length;
2041 gboolean ind_field;
2043 while (tvb_reported_length_remaining(tvb, offset) > 0)
2045 saved_offset = offset;
2047 offset = get_ber_identifier(tvb, offset, &ber_class, &pc, &tag);
2048 tag_offset = offset;
2049 offset = get_ber_length(tvb, offset, &len, &ind_field);
2050 len_offset = offset;
2052 tag_length = tag_offset - saved_offset;
2053 len_length = len_offset - tag_offset;
2055 if (pc)
2057 pi = proto_tree_add_text(tree, tvb, saved_offset,
2058 len + (len_offset - saved_offset),
2059 "CONSTRUCTOR");
2060 subtree = proto_item_add_subtree(pi, ett_param);
2061 proto_tree_add_uint_format(subtree, hf_tcap_tag, tvb,
2062 saved_offset, tag_length, tag,
2063 "CONSTRUCTOR Tag");
2064 proto_tree_add_uint(subtree, hf_tcap_tag, tvb, saved_offset,
2065 tag_length, ber_class);
2067 proto_tree_add_uint(subtree, hf_tcap_length, tvb, tag_offset,
2068 len_length, len);
2070 if (len-(2*ind_field)) /*should always be positive unless we get an empty contructor pointless? */
2072 next_tvb = tvb_new_subset(tvb, offset, len-(2*ind_field),
2073 len-(2*ind_field));
2074 dissect_tcap_param(actx, subtree,next_tvb,0);
2077 if (ind_field)
2078 proto_tree_add_text(subtree, tvb, offset+len-2, 2, "CONSTRUCTOR EOC");
2080 offset += len;
2082 else
2084 pi = proto_tree_add_text(tree, tvb, saved_offset,
2085 len + (len_offset - saved_offset),
2086 "Parameter (0x%.2x)", tag);
2088 subtree = proto_item_add_subtree(pi, ett_param);
2090 proto_tree_add_uint(subtree, hf_tcap_tag, tvb, saved_offset,
2091 tag_length, tag);
2093 proto_tree_add_uint(subtree, hf_tcap_length, tvb,
2094 saved_offset+tag_length, len_length, len);
2096 if (len) /* check for NULLS */
2098 next_tvb = tvb_new_subset(tvb, offset, len, len);
2099 dissect_ber_octet_string(TRUE, actx, tree, next_tvb, 0,
2100 hf_tcap_data, NULL);
2103 offset += len;
2106 return offset;
2109 static void raz_tcap_private(struct tcap_private_t * p_tcap_private)
2111 memset(p_tcap_private,0,sizeof(struct tcap_private_t) );
2115 * Call ITU Subdissector to decode the Tcap Component
2117 static int
2118 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_)
2120 dissector_handle_t subdissector_handle=NULL;
2121 gboolean is_subdissector=FALSE;
2122 struct tcaphash_context_t * p_tcap_context=NULL;
2125 * ok lets look at the oid and ssn and try and find a dissector, otherwise lets decode it.
2129 * Handle The TCAP Service Response Time
2131 if ( gtcap_HandleSRT ) {
2132 if (!tcap_subdissector_used) {
2133 p_tcap_context=tcapsrt_call_matching(tvb, actx->pinfo, tcap_stat_tree, gp_tcapsrt_info);
2134 tcap_subdissector_used=TRUE;
2135 gp_tcap_context=p_tcap_context;
2136 tcap_private.context=p_tcap_context;
2137 }else{
2138 /* Take the last TCAP context */
2139 p_tcap_context = gp_tcap_context;
2140 tcap_private.context=p_tcap_context;
2143 if (p_tcap_context) {
2144 if (cur_oid) {
2145 if (p_tcap_context->oid_present) {
2146 /* We have already an Application Context, check if we have
2147 to fallback to a lower version */
2148 if ( strncmp(p_tcap_context->oid, cur_oid, sizeof(p_tcap_context->oid))!=0) {
2149 /* ACN, changed, Fallback to lower version
2150 * and update the subdissector (purely formal)
2152 g_strlcpy(p_tcap_context->oid,cur_oid, sizeof(p_tcap_context->oid));
2153 if ( (subdissector_handle = dissector_get_string_handle(ber_oid_dissector_table, cur_oid)) ) {
2154 p_tcap_context->subdissector_handle=subdissector_handle;
2155 p_tcap_context->subdissector_present=TRUE;
2158 } else {
2159 /* We do not have the OID in the TCAP context, so store it */
2160 g_strlcpy(p_tcap_context->oid, cur_oid, sizeof(p_tcap_context->oid));
2161 p_tcap_context->oid_present=TRUE;
2162 /* Try to find a subdissector according to OID */
2163 if ( (subdissector_handle
2164 = dissector_get_string_handle(ber_oid_dissector_table, cur_oid)) ) {
2165 p_tcap_context->subdissector_handle=subdissector_handle;
2166 p_tcap_context->subdissector_present=TRUE;
2167 } else {
2168 /* Not found, so try to find a subdissector according to SSN */
2169 if ( (subdissector_handle = get_itu_tcap_subdissector(actx->pinfo->match_uint))) {
2170 /* Found according to SSN */
2171 p_tcap_context->subdissector_handle=subdissector_handle;
2172 p_tcap_context->subdissector_present=TRUE;
2175 } /* context OID */
2176 } else {
2177 /* Copy the OID from the TCAP context to the current oid */
2178 if (p_tcap_context->oid_present) {
2179 tcap_private.oid= (void*) p_tcap_context->oid;
2180 tcap_private.acv=TRUE;
2182 } /* no OID */
2183 } /* no TCAP context */
2186 if ( p_tcap_context
2187 && p_tcap_context->subdissector_present) {
2188 /* Take the subdissector from the context */
2189 subdissector_handle=p_tcap_context->subdissector_handle;
2190 is_subdissector=TRUE;
2193 /* Have SccpUsersTable protocol taking precedence over sccp.ssn table */
2194 if (!is_subdissector && requested_subdissector_handle) {
2195 is_subdissector = TRUE;
2196 subdissector_handle = requested_subdissector_handle;
2199 if (!is_subdissector) {
2201 * If we do not currently know the subdissector, we have to find it
2202 * - first, according to the OID
2203 * - then according to the SSN
2204 * - and at least, take the default Data handler
2206 if (ber_oid_dissector_table && cur_oid) {
2207 /* Search if we can find the sub protocol according to the A.C.N */
2208 if ( (subdissector_handle
2209 = dissector_get_string_handle(ber_oid_dissector_table, cur_oid)) ) {
2210 /* found */
2211 is_subdissector=TRUE;
2212 } else {
2213 /* Search if we can found the sub protocol according to the SSN table */
2214 if ( (subdissector_handle
2215 = get_itu_tcap_subdissector(actx->pinfo->match_uint))) {
2216 /* Found according to SSN */
2217 is_subdissector=TRUE;
2218 } else {
2219 /* Nothing found, take the Data handler */
2220 subdissector_handle = data_handle;
2221 is_subdissector=TRUE;
2222 } /* SSN */
2223 } /* ACN */
2224 } else {
2225 /* There is no A.C.N for this transaction, so search in the SSN table */
2226 if ( (subdissector_handle = get_itu_tcap_subdissector(actx->pinfo->match_uint))) {
2227 /* Found according to SSN */
2228 is_subdissector=TRUE;
2229 } else {
2230 subdissector_handle = data_handle;
2231 is_subdissector=TRUE;
2233 } /* OID */
2234 } else {
2235 /* We have it already */
2238 /* Call the sub dissector if present, and not already called */
2239 if (is_subdissector)
2240 call_dissector_with_data(subdissector_handle, tvb, actx->pinfo, tree, actx->value_ptr);
2242 return offset;
2245 void call_tcap_dissector(dissector_handle_t handle, tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) {
2247 requested_subdissector_handle = handle;
2249 TRY {
2250 dissect_tcap(tvb, pinfo, tree);
2251 } CATCH_ALL {
2252 requested_subdissector_handle = NULL;
2253 RETHROW;
2254 } ENDTRY;
2256 requested_subdissector_handle = NULL;