2 * Routines for TCAP dissection
4 * Copyright 2000, Samuel Qu <samuel.qu [AT] utstar.com>,
6 * Michael Lum <mlum [AT] telostech.com>,
7 * Modified for ANSI TCAP support and many changes for
10 * (append your name here for newer version)
12 * $Id: packet-tcap.c,v 1.11 2004/05/24 02:25:19 guy Exp $
14 * Ethereal - Network traffic analyzer
15 * By Gerald Combs <gerald@ethereal.com>
16 * Copyright 1998 Gerald Combs
18 * Copied from WHATEVER_FILE_YOU_USED (where "WHATEVER_FILE_YOU_USED"
19 * is a dissector file; if you just copied this from README.developer,
20 * don't bother with the "Copied from" - you don't even need to put
21 * in a "Copied from" if you copied an existing dissector, especially
22 * if the bulk of the code in the new dissector is your code)
24 * This program is free software; you can redistribute it and/or
25 * modify it under the terms of the GNU General Public License
26 * as published by the Free Software Foundation; either version 2
27 * of the License, or (at your option) any later version.
29 * This program is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 * GNU General Public License for more details.
34 * You should have received a copy of the GNU General Public License
35 * along with this program; if not, write to the Free Software
36 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
48 #ifdef HAVE_SYS_TYPES_H
49 # include <sys/types.h>
52 #ifdef HAVE_NETINET_IN_H
53 # include <netinet/in.h>
58 #ifdef NEED_SNPRINTF_H
59 # include "snprintf.h"
62 #include <epan/packet.h>
65 #include "packet-tcap.h"
67 Tcap_Standard_Type tcap_standard = ITU_TCAP_STANDARD;
70 static packet_info *g_pinfo = NULL;
71 static proto_tree *g_tcap_tree = NULL;
72 static gboolean g_tcap_ends_def_len = FALSE;
74 /* Initialize the protocol and registered fields */
75 static int proto_tcap = -1;
76 static int hf_tcap_message_type = -1;
77 static int hf_ansi_tcap_message_type = -1;
78 static int hf_tcap_tag = -1;
79 static int hf_tcap_length = -1;
80 static int hf_tcap_bytes = -1;
81 static int hf_tcap_app_con_name = -1;
82 static int hf_tcap_id = -1;
83 static int hf_tcap_tid = -1;
84 static int hf_tcap_ssn = -1; /* faked */
85 static int hf_tcap_dlg_type = -1;
86 static int hf_tcap_int = -1;
88 /* Initialize the subtree pointers */
89 static gint ett_tcap = -1;
91 static gint ett_otid = -1;
92 static gint ett_dtid = -1;
93 static gint ett_dlg_portion = -1;
94 static gint ett_dlg_req = -1;
95 static gint ett_dlg_rsp = -1;
96 static gint ett_dlg_abort = -1;
97 static gint ett_comps_portion = -1;
98 static gint ett_reason = -1;
99 static gint ett_component = -1;
100 static gint ett_problem = -1;
101 static gint ett_error = -1;
102 static gint ett_params = -1;
103 static gint ett_param = -1;
105 static dissector_handle_t data_handle;
106 static dissector_table_t tcap_itu_ssn_dissector_table; /* map use ssn in sccp */
107 static dissector_table_t tcap_ansi_ssn_dissector_table; /* map use ssn in sccp */
108 static gboolean lock_info_col = TRUE;
110 /* TCAP transaction message type definition - Samuel */
111 #define ST_MSG_TYP_UNI 0x61 /*0b01100001*/
112 #define ST_MSG_TYP_BGN 0x62 /*0b01100010*/
113 #define ST_MSG_TYP_CNT 0x65 /*0b01100101*/
114 #define ST_MSG_TYP_END 0x64 /*0b01100100*/
115 #define ST_MSG_TYP_PABT 0x67 /*0b01100111*/
116 static const value_string msg_type_strings[] = {
117 { ST_MSG_TYP_UNI, "TC-UNI" },
118 { ST_MSG_TYP_BGN, "TC-BEGIN" },
119 { ST_MSG_TYP_CNT, "TC-CONTINUE" },
120 { ST_MSG_TYP_END, "TC-END" },
121 { ST_MSG_TYP_PABT, "TC-PABORT" },
125 /* ANSI TCAP transaction message type definition */
126 #define ANSI_ST_MSG_TYP_UNI 0xe1
127 #define ANSI_ST_MSG_TYP_QWP 0xe2
128 #define ANSI_ST_MSG_TYP_QWOP 0xe3
129 #define ANSI_ST_MSG_TYP_RSP 0xe4
130 #define ANSI_ST_MSG_TYP_CWP 0xe5
131 #define ANSI_ST_MSG_TYP_CWOP 0xe6
132 #define ANSI_ST_MSG_TYP_ABT 0xf6
133 static const value_string ansi_msg_type_strings[] = {
134 { ANSI_ST_MSG_TYP_UNI, "TC-UNI" },
135 { ANSI_ST_MSG_TYP_QWP, "TC-QUERY W PERM" },
136 { ANSI_ST_MSG_TYP_QWOP, "TC-QUERY WO PERM" },
137 { ANSI_ST_MSG_TYP_RSP, "TC-RESPONSE" },
138 { ANSI_ST_MSG_TYP_CWP, "TC-CONV W PERM" },
139 { ANSI_ST_MSG_TYP_CWOP, "TC-CONV WO PERM" },
140 { ANSI_ST_MSG_TYP_ABT, "TC-ABORT" },
144 #define ST_ANSI_CMP_TAG 0xe8
145 #define ST_ANSI_TID_TAG 0xc7
147 /* TCAP TID tag value - Samuel */
148 #define ST_TID_SOURCE 0
149 #define ST_TID_DEST 1
150 #define ST_ITU_ORG_TID_TAG 0x48 /*0b01001000*/
151 #define ST_ITU_DST_TID_TAG 0x49 /*0b01001001*/
152 #define ST_ITU_PABT_TAG 0x4a /*0b01001010*/
153 #define ST_ITU_DLG_TAG 0x6b
154 #define ST_ITU_CMP_TAG 0x6c
156 static const value_string tid_strings[] = {
157 { ST_ITU_ORG_TID_TAG, "Source Transaction ID" },
158 { ST_ITU_DST_TID_TAG, "Destination Transaction ID" },
162 /* TCAP dialog type */
163 #define TC_DLG_REQ 0x60
164 #define TC_DLG_RSP 0x61
165 #define TC_DLG_ABRT 0x64
167 static const value_string dlg_type_strings[] = {
168 { TC_DLG_REQ , "Dialogue Request" },
169 { TC_DLG_RSP , "Dialogue Response" },
170 { TC_DLG_ABRT, "Dialogue Abort" },
174 const value_string tcap_component_type_str[] = {
175 { TCAP_COMP_INVOKE, "Invoke" },
176 { TCAP_COMP_RRL, "Return Result(L)" },
177 { TCAP_COMP_RE, "Return Error" },
178 { TCAP_COMP_REJECT, "Reject" },
179 { TCAP_COMP_RRN, "Return Result(NL)" },
187 tcap_find_eoc(ASN1_SCK *asn1)
194 saved_offset = asn1->offset;
196 while (!asn1_eoc(asn1, -1))
198 asn1_id_decode1(asn1, &tag);
199 asn1_length_decode(asn1, &def_len, &len);
207 asn1->offset += tcap_find_eoc(asn1);
208 asn1_eoc_decode(asn1, -1);
212 len = asn1->offset - saved_offset;
213 asn1->offset = saved_offset;
219 tcap_check_tag(ASN1_SCK *asn1, guint tag)
221 guint saved_offset, real_tag;
223 if (tvb_length_remaining(asn1->tvb, asn1->offset) <= 0)
228 saved_offset = asn1->offset;
229 asn1_id_decode1(asn1, &real_tag);
230 asn1->offset = saved_offset;
231 return (tag == real_tag);
236 dissect_tcap_len(ASN1_SCK *asn1, proto_tree *tree, gboolean *def_len, guint *len)
241 saved_offset = asn1->offset;
244 ret = asn1_length_decode(asn1, def_len, len);
248 proto_tree_add_uint(tree, hf_tcap_length, asn1->tvb, saved_offset, asn1->offset - saved_offset, *len);
252 proto_tree_add_text(tree, asn1->tvb,
253 saved_offset, asn1->offset - saved_offset, "Length: Indefinite");
260 dissect_tcap_eoc(ASN1_SCK *asn1, proto_tree *tree)
262 guint saved_offset, ret;
264 saved_offset = asn1->offset;
266 if (tvb_length_remaining(asn1->tvb, saved_offset) <= 0)
271 if (!asn1_eoc(asn1, -1))
276 ret = asn1_eoc_decode(asn1, -1);
278 proto_tree_add_text(tree, asn1->tvb,
279 saved_offset, asn1->offset - saved_offset, "End of Contents");
285 dissect_tcap_tag(ASN1_SCK *asn1, proto_tree *tree, guint *tag, gchar * str)
287 guint saved_offset, real_tag;
289 saved_offset = asn1->offset;
290 asn1_id_decode1(asn1, &real_tag);
291 if ((*tag != (guint) -1) && (real_tag != *tag))
293 asn1->offset = saved_offset;
296 proto_tree_add_uint_format(tree, hf_tcap_tag, asn1->tvb, saved_offset, asn1->offset - saved_offset,
302 dissect_tcap_octet(ASN1_SCK *asn1, proto_tree *tree, gchar * str)
307 saved_offset = asn1->offset;
308 asn1_octet_decode(asn1, &my_oct);
309 proto_tree_add_uint_format(tree, hf_tcap_id, asn1->tvb, saved_offset, asn1->offset - saved_offset,
310 my_oct, "%s %d", str, my_oct);
315 dissect_tcap_integer(ASN1_SCK *asn1, proto_tree *tree, guint len, gchar * str)
320 saved_offset = asn1->offset;
321 asn1_int32_value_decode(asn1, len, &invokeId);
322 proto_tree_add_int_format(tree, hf_tcap_int, asn1->tvb, saved_offset, asn1->offset - saved_offset,
323 invokeId, "%s %d", str, invokeId);
329 dissect_tcap_tid(ASN1_SCK *asn1, proto_tree *tcap_tree, proto_item *ti, int type)
331 guint saved_offset, org_offset = 0;
335 proto_item *tid_item;
341 org_offset = asn1->offset;
342 if ( ST_TID_SOURCE == type)
344 tid_item = proto_tree_add_text(tcap_tree, asn1->tvb, asn1->offset, -1, "Source Transaction ID");
345 subtree = proto_item_add_subtree(tid_item, ett_otid);
349 tid_item = proto_tree_add_text(tcap_tree, asn1->tvb, asn1->offset, -1, "Destination Transaction ID");
350 subtree = proto_item_add_subtree(tid_item, ett_dtid);
353 saved_offset = asn1->offset;
354 ret = asn1_id_decode1(asn1, &tag);
355 proto_tree_add_uint(subtree, hf_tcap_tid, asn1->tvb, saved_offset, asn1->offset - saved_offset, tag);
361 if (ST_ITU_ORG_TID_TAG != tag)
363 asn1->offset = saved_offset;
368 if (ST_ITU_DST_TID_TAG != tag)
370 asn1->offset = saved_offset;
379 dissect_tcap_len(asn1, subtree, &def_len, &len);
382 * XXX - this is, I think, an OCTET STRING (SIZE(1..4)); should it
383 * just be put into the protocol tree as an FT_BYTES value and
384 * displayed in the Info column with "bytes_to_str()"?
386 * If so, should we have separate hf_tcap_source_tid and
387 * hf_tcap_destination_tid?
389 * Does that apply to other transaction IDs?
396 saved_offset = asn1->offset;
397 ret = asn1_string_value_decode(asn1, len, &poctets);
399 memcpy(&val, poctets, len);
401 ti = proto_tree_add_uint(subtree, hf_tcap_id, asn1->tvb, saved_offset, asn1->offset - saved_offset, val);
404 proto_item_set_len(tid_item, asn1->offset - org_offset);
406 if (type == ST_TID_DEST)
408 if (check_col(g_pinfo->cinfo, COL_INFO))
409 col_append_fstr(g_pinfo->cinfo, COL_INFO, "dtid(%x) ", val);
413 if (check_col(g_pinfo->cinfo, COL_INFO))
414 col_append_fstr(g_pinfo->cinfo, COL_INFO, "stid(%x) ", val);
421 /* dissect operation portion */
423 dissect_tcap_invokeId(ASN1_SCK *asn1, proto_tree *tree)
429 #define INVOKE_ID_TAG 0x2
430 if (tcap_check_tag(asn1, INVOKE_ID_TAG))
433 dissect_tcap_tag(asn1, tree, &tag, "Invoke ID Tag");
434 dissect_tcap_len(asn1, tree, &def_len, &len);
435 dissect_tcap_integer(asn1, tree, len, "Invoke ID:");
442 dissect_tcap_lnkId(ASN1_SCK *asn1, proto_tree *tree)
448 if (tcap_check_tag(asn1, TCAP_LINKED_ID_TAG))
451 dissect_tcap_tag(asn1, tree, &tag, "Linked ID Tag");
452 dissect_tcap_len(asn1, tree, &def_len, &len);
453 dissect_tcap_integer(asn1, tree, len, "Linked ID:");
460 dissect_tcap_opr_code(ASN1_SCK *asn1, proto_tree *tree)
464 gboolean got_it = FALSE;
467 #define TCAP_LOC_OPR_CODE_TAG 0x02
468 if (tcap_check_tag(asn1, TCAP_LOC_OPR_CODE_TAG))
471 dissect_tcap_tag(asn1, tree, &tag, "Local Operation Code Tag");
474 #define TCAP_GLB_OPR_CODE_TAG 0x06
475 else if (tcap_check_tag(asn1, TCAP_GLB_OPR_CODE_TAG))
478 dissect_tcap_tag(asn1, tree, &tag, "Global Operation Code Tag");
484 dissect_tcap_len(asn1, tree, &def_len, &len);
486 proto_tree_add_text(tree, asn1->tvb, asn1->offset, len, "Operation Code");
493 dissect_tcap_param(ASN1_SCK *asn1, proto_tree *tree, guint exp_len)
495 guint orig_offset, saved_offset, len_offset;
501 orig_offset = asn1->offset;
503 #define TC_INVALID_TAG 0
504 while ((tvb_length_remaining(asn1->tvb, asn1->offset) > 0) &&
505 (!tcap_check_tag(asn1, 0)))
507 if ((exp_len != 0) &&
508 ((asn1->offset - orig_offset) >= exp_len))
513 saved_offset = asn1->offset;
514 asn1_id_decode1(asn1, &tag);
515 len_offset = asn1->offset;
516 asn1_length_decode(asn1, &def_len, &len);
518 if (TCAP_CONSTRUCTOR(tag))
521 proto_tree_add_text(tree, asn1->tvb, saved_offset, -1, "Sequence");
523 subtree = proto_item_add_subtree(item, ett_params);
525 proto_tree_add_uint_format(subtree, hf_tcap_tag, asn1->tvb,
526 saved_offset, len_offset - saved_offset, tag, "Sequence Tag");
530 proto_tree_add_uint(subtree, hf_tcap_length, asn1->tvb,
531 len_offset, asn1->offset - len_offset, len);
535 proto_tree_add_text(subtree, asn1->tvb,
536 len_offset, asn1->offset - len_offset, "Length: Indefinite");
538 len = tcap_find_eoc(asn1);
541 proto_item_set_len(item,
542 (asn1->offset - saved_offset) + len +
543 (def_len ? 0 : TCAP_EOC_LEN));
545 dissect_tcap_param(asn1, subtree, len);
549 dissect_tcap_eoc(asn1, subtree);
556 proto_tree_add_uint_format(tree, hf_tcap_tag, asn1->tvb,
557 saved_offset, len_offset - saved_offset, tag, "Parameter Tag");
559 proto_tree_add_text(tree, asn1->tvb,
560 len_offset, asn1->offset - len_offset, "Length: Indefinite");
562 len = tcap_find_eoc(asn1);
564 dissect_tcap_param(asn1, tree, len);
566 dissect_tcap_eoc(asn1, tree);
571 proto_tree_add_text(tree, asn1->tvb,
572 saved_offset, (asn1->offset - saved_offset) + len, "Parameter");
574 subtree = proto_item_add_subtree(item, ett_param);
576 proto_tree_add_uint_format(subtree, hf_tcap_tag, asn1->tvb,
577 saved_offset, len_offset - saved_offset, tag, "Parameter Tag");
579 proto_tree_add_uint(subtree, hf_tcap_length, asn1->tvb,
580 len_offset, asn1->offset - len_offset, len);
582 proto_tree_add_text(subtree, asn1->tvb,
583 asn1->offset, len, "Parameter Data");
592 dissect_tcap_component(ASN1_SCK *asn1, proto_tree *tree, guint *len_p)
601 saved_offset = asn1->offset;
602 asn1_id_decode1(asn1, &tag);
605 proto_tree_add_text(tree, asn1->tvb, saved_offset, -1, "Component ID");
607 subtree = proto_item_add_subtree(item, ett_component);
609 proto_tree_add_uint_format(subtree, hf_tcap_tag, asn1->tvb,
610 saved_offset, asn1->offset - saved_offset, tag,
611 "Component ID Identifier");
613 dissect_tcap_len(asn1, subtree, &def_len, len_p);
615 proto_item_set_len(item, (asn1->offset - saved_offset) + *len_p);
621 dissect_tcap_problem(ASN1_SCK *asn1, proto_tree *tree)
623 guint orig_offset, saved_offset, len_offset;
627 proto_item *item = NULL;
629 gchar *type_str = NULL;
634 orig_offset = asn1->offset;
635 saved_offset = asn1->offset;
636 asn1_id_decode1(asn1, &tag);
638 len_offset = asn1->offset;
639 asn1_length_decode(asn1, &def_len, &len);
642 proto_tree_add_text(tree, asn1->tvb, saved_offset, -1, "Problem Code");
644 subtree = proto_item_add_subtree(item, ett_problem);
648 len = tcap_find_eoc(asn1);
651 proto_item_set_len(item, (asn1->offset - saved_offset) + len +
652 (def_len ? 0 : TCAP_EOC_LEN));
656 proto_tree_add_text(subtree, asn1->tvb,
657 asn1->offset, len, "Unknown encoding of Problem Code");
663 asn1_eoc_decode(asn1, -1);
669 saved_offset = asn1->offset;
670 asn1_int32_value_decode(asn1, 1, &spec);
675 type_str = "General Problem";
678 case 0: str = "Unrecognized Component"; break;
679 case 1: str = "Mistyped Component"; break;
680 case 2: str = "Badly Structured Component"; break;
691 case 0: str = "Duplicate Invoke ID"; break;
692 case 1: str = "Unrecognized Operation"; break;
693 case 2: str = "Mistyped Parameter"; break;
694 case 3: str = "Resource Limitation"; break;
695 case 4: str = "Initiating Release"; break;
696 case 5: str = "Unrecognized Linked ID"; break;
697 case 6: str = "Linked Response Unexpected"; break;
698 case 7: str = "Unexpected Linked Operation"; break;
706 type_str = "Return Result";
709 case 0: str = "Unrecognized Invoke ID"; break;
710 case 1: str = "Return Result Unexpected"; break;
711 case 2: str = "Mistyped Parameter"; break;
719 type_str = "Return Error";
722 case 0: str = "Unrecognized Invoke ID"; break;
723 case 1: str = "Return Error Unexpected"; break;
724 case 2: str = "Unrecognized Error"; break;
725 case 3: str = "Unexpected Error"; break;
726 case 4: str = "Mistyped Parameter"; break;
734 type_str = "Undefined";
738 proto_tree_add_uint_format(subtree, hf_tcap_tag, asn1->tvb,
739 orig_offset, len_offset - orig_offset, tag, type_str);
743 proto_tree_add_uint(subtree, hf_tcap_length, asn1->tvb,
744 len_offset, saved_offset - len_offset, len);
748 proto_tree_add_text(subtree, asn1->tvb,
749 len_offset, saved_offset - len_offset, "Length: Indefinite");
752 proto_tree_add_text(subtree, asn1->tvb, saved_offset, 1,
753 "Problem Specifier %s", str);
758 dissect_ansi_opr_code(ASN1_SCK *asn1, proto_tree *tree)
762 gboolean got_it = FALSE;
765 #define TCAP_NAT_OPR_CODE_TAG 0xd0
766 if (tcap_check_tag(asn1, TCAP_NAT_OPR_CODE_TAG))
769 dissect_tcap_tag(asn1, tree, &tag, "National TCAP Operation Code Identifier");
772 #define TCAP_PRIV_OPR_CODE_TAG 0xd1
773 else if (tcap_check_tag(asn1, TCAP_PRIV_OPR_CODE_TAG))
776 dissect_tcap_tag(asn1, tree, &tag, "Private TCAP Operation Code Identifier");
782 dissect_tcap_len(asn1, tree, &def_len, &len);
784 proto_tree_add_text(tree, asn1->tvb, asn1->offset, len, "Operation Code");
791 dissect_ansi_problem(ASN1_SCK *asn1, proto_tree *tree)
793 guint saved_offset = 0;
797 proto_item *item = NULL;
799 gchar *type_str = NULL;
804 #define TCAP_PROB_CODE_TAG 0xd5
805 if (tcap_check_tag(asn1, TCAP_PROB_CODE_TAG))
807 str = "Problem Code Identifier";
815 saved_offset = asn1->offset;
816 asn1_id_decode1(asn1, &tag);
819 proto_tree_add_text(tree, asn1->tvb, saved_offset, -1, "Problem Code");
821 subtree = proto_item_add_subtree(item, ett_problem);
823 proto_tree_add_uint_format(subtree, hf_tcap_tag, asn1->tvb,
824 saved_offset, asn1->offset - saved_offset, tag, str);
826 dissect_tcap_len(asn1, subtree, &def_len, &len);
827 proto_item_set_len(item, (asn1->offset - saved_offset) + len);
831 proto_tree_add_text(subtree, asn1->tvb,
832 asn1->offset, len, "Unknown encoding of Problem Code");
838 saved_offset = asn1->offset;
839 asn1_int32_value_decode(asn1, 1, &type);
840 asn1_int32_value_decode(asn1, 1, &spec);
844 case 0: type_str = "Not used"; break;
847 type_str = "General";
850 case 1: str = "Unrecognized Component Type"; break;
851 case 2: str = "Incorrect Component Portion"; break;
852 case 3: str = "Badly Structured Component Portion"; break;
863 case 1: str = "Duplicate Invoke ID"; break;
864 case 2: str = "Unrecognized Operation Code"; break;
865 case 3: str = "Incorrect Parameter"; break;
866 case 4: str = "Unrecognized Correlation ID"; break;
874 type_str = "Return Result";
877 case 1: str = "Unrecognized Correlation ID"; break;
878 case 2: str = "Unexpected Return Result"; break;
879 case 3: str = "Incorrect Parameter"; break;
887 type_str = "Return Error";
890 case 1: str = "Unrecognized Correlation ID"; break;
891 case 2: str = "Unexpected Return Error"; break;
892 case 3: str = "Unrecognized Error"; break;
893 case 4: str = "Unexpected Error"; break;
894 case 5: str = "Incorrect Parameter"; break;
902 type_str = "Transaction Portion";
905 case 1: str = "Unrecognized Package Type"; break;
906 case 2: str = "Incorrect Transaction Portion"; break;
907 case 3: str = "Badly Structured Transaction Portion"; break;
908 case 4: str = "Unrecognized Transaction ID"; break;
909 case 5: str = "Permission to Release"; break;
910 case 6: str = "Resource Unavailable"; break;
918 type_str = "Undefined";
922 if (spec == 255) { str = "Reserved"; }
923 else if (spec == 0) { str = "Not used"; }
925 proto_tree_add_text(subtree, asn1->tvb,
926 saved_offset, 1, "Problem Type %s", type_str);
928 proto_tree_add_text(subtree, asn1->tvb,
929 saved_offset + 1, 1, "Problem Specifier %s", str);
934 dissect_ansi_error(ASN1_SCK *asn1, proto_tree *tree)
936 guint saved_offset = 0;
940 proto_item *item = NULL;
945 #define TCAP_NAT_ERR_CODE_TAG 0xd3
946 if (tcap_check_tag(asn1, TCAP_NAT_ERR_CODE_TAG))
948 str = "National TCAP Error Code Identifier";
950 #define TCAP_PRIV_ERR_CODE_TAG 0xd4
951 else if (tcap_check_tag(asn1, TCAP_PRIV_ERR_CODE_TAG))
953 str = "Private TCAP Error Code Identifier";
961 saved_offset = asn1->offset;
962 asn1_id_decode1(asn1, &tag);
965 proto_tree_add_text(tree, asn1->tvb,
966 saved_offset, -1, "TCAP Error Code");
968 subtree = proto_item_add_subtree(item, ett_error);
970 proto_tree_add_uint_format(subtree, hf_tcap_tag, asn1->tvb,
971 saved_offset, asn1->offset - saved_offset, tag, str);
973 dissect_tcap_len(asn1, subtree, &def_len, &len);
974 proto_item_set_len(item, (asn1->offset - saved_offset) + len);
976 proto_tree_add_text(subtree, asn1->tvb, asn1->offset, len, "Error Code");
983 dissect_ansi_param(ASN1_SCK *asn1, proto_tree *tree)
987 gboolean got_it = FALSE;
990 #define TCAP_PARAM_SET_TAG 0xf2
991 if (tcap_check_tag(asn1, TCAP_PARAM_SET_TAG))
994 dissect_tcap_tag(asn1, tree, &tag, "Parameter Set Identifier");
997 #define TCAP_PARAM_SEQ_TAG 0x30
998 else if (tcap_check_tag(asn1, TCAP_PARAM_SEQ_TAG))
1001 dissect_tcap_tag(asn1, tree, &tag, "Parameter Sequence Identifier");
1007 dissect_tcap_len(asn1, tree, &def_len, &len);
1009 proto_tree_add_text(tree, asn1->tvb, asn1->offset, len, "Parameter Data");
1011 asn1->offset += len;
1016 dissect_ansi_tcap_reject(ASN1_SCK *asn1, proto_tree *tree)
1019 proto_tree *subtree;
1021 #define COMPONENT_ID_TAG 0xcf
1022 if (tcap_check_tag(asn1, COMPONENT_ID_TAG))
1024 subtree = dissect_tcap_component(asn1, tree, &len);
1029 dissect_tcap_octet(asn1, subtree, "Correlation ID:");
1034 dissect_ansi_problem(asn1, tree);
1036 dissect_ansi_param(asn1, tree);
1040 dissect_ansi_tcap_re(ASN1_SCK *asn1, proto_tree *tree)
1043 proto_tree *subtree;
1045 #define COMPONENT_ID_TAG 0xcf
1046 if (tcap_check_tag(asn1, COMPONENT_ID_TAG))
1048 subtree = dissect_tcap_component(asn1, tree, &len);
1053 dissect_tcap_octet(asn1, tree, "Correlation ID:");
1058 dissect_ansi_error(asn1, tree);
1060 dissect_ansi_param(asn1, tree);
1064 dissect_ansi_tcap_rr(ASN1_SCK *asn1, proto_tree *tree)
1067 proto_tree *subtree;
1069 #define COMPONENT_ID_TAG 0xcf
1070 if (tcap_check_tag(asn1, COMPONENT_ID_TAG))
1072 subtree = dissect_tcap_component(asn1, tree, &len);
1077 dissect_tcap_octet(asn1, tree, "Correlation ID:");
1082 dissect_ansi_param(asn1, tree);
1086 dissect_ansi_tcap_invoke(ASN1_SCK *asn1, proto_tree *tree)
1089 proto_tree *subtree;
1091 #define COMPONENT_ID_TAG 0xcf
1092 if (tcap_check_tag(asn1, COMPONENT_ID_TAG))
1094 subtree = dissect_tcap_component(asn1, tree, &len);
1099 dissect_tcap_octet(asn1, tree, "Invoke ID:");
1103 dissect_tcap_octet(asn1, tree, "Invoke ID:");
1104 dissect_tcap_octet(asn1, tree, "Correlation ID:");
1109 dissect_ansi_opr_code(asn1, tree);
1111 dissect_ansi_param(asn1, tree);
1115 dissect_tcap_invoke(ASN1_SCK *asn1, proto_tree *tree)
1117 proto_tree *subtree;
1118 guint orig_offset, saved_offset;
1125 orig_offset = asn1->offset;
1126 saved_offset = asn1->offset;
1127 ret = asn1_id_decode1(asn1, &tag);
1130 proto_tree_add_text(tree, asn1->tvb, saved_offset, -1, "Component");
1132 subtree = proto_item_add_subtree(item, ett_component);
1134 proto_tree_add_uint_format(subtree, hf_tcap_tag, asn1->tvb,
1135 saved_offset, asn1->offset - saved_offset, tag, "Invoke Type Tag");
1137 dissect_tcap_len(asn1, subtree, &def_len, &len);
1139 saved_offset = asn1->offset;
1141 dissect_tcap_invokeId(asn1, subtree);
1143 dissect_tcap_lnkId(asn1, subtree);
1145 dissect_tcap_opr_code(asn1, subtree);
1149 len -= asn1->offset - saved_offset;
1153 len = tcap_find_eoc(asn1);
1156 dissect_tcap_param(asn1, subtree, len);
1160 dissect_tcap_eoc(asn1, subtree);
1163 proto_item_set_len(item, asn1->offset - orig_offset);
1167 dissect_tcap_rr(ASN1_SCK *asn1, proto_tree *tree, gchar *str)
1169 guint tag, len, comp_len;
1170 guint orig_offset, saved_offset, len_offset;
1171 proto_item *seq_item, *item;
1172 proto_tree *seq_subtree, *subtree;
1174 gboolean comp_def_len;
1177 orig_offset = asn1->offset;
1178 saved_offset = asn1->offset;
1179 asn1_id_decode1(asn1, &tag);
1182 proto_tree_add_text(tree, asn1->tvb, saved_offset, -1, "Component");
1184 subtree = proto_item_add_subtree(item, ett_component);
1186 proto_tree_add_uint_format(subtree, hf_tcap_tag, asn1->tvb,
1187 saved_offset, asn1->offset - saved_offset, tag, str);
1189 dissect_tcap_len(asn1, subtree, &comp_def_len, &comp_len);
1191 saved_offset = asn1->offset;
1193 dissect_tcap_invokeId(asn1, subtree);
1195 if (tvb_length_remaining(asn1->tvb, asn1->offset) <= 0)
1197 proto_item_set_len(item, asn1->offset - orig_offset);
1202 saved_offset = asn1->offset;
1205 asn1_id_decode1(asn1, &tag);
1207 if (TCAP_CONSTRUCTOR(tag))
1209 len_offset = asn1->offset;
1210 asn1_length_decode(asn1, &def_len, &len);
1213 proto_tree_add_text(subtree, asn1->tvb, saved_offset, -1, "Sequence");
1215 seq_subtree = proto_item_add_subtree(seq_item, ett_params);
1217 proto_tree_add_uint_format(seq_subtree, hf_tcap_tag, asn1->tvb,
1218 saved_offset, len_offset - saved_offset, tag, "Sequence Tag");
1222 proto_tree_add_uint(seq_subtree, hf_tcap_length, asn1->tvb,
1223 len_offset, asn1->offset - len_offset, len);
1227 proto_tree_add_text(seq_subtree, asn1->tvb,
1228 len_offset, asn1->offset - len_offset, "Length: Indefinite");
1230 len = tcap_find_eoc(asn1);
1233 proto_item_set_len(seq_item,
1234 (asn1->offset - saved_offset) + len +
1235 (def_len ? 0 : TCAP_EOC_LEN));
1237 saved_offset = asn1->offset;
1239 dissect_tcap_opr_code(asn1, seq_subtree);
1241 len -= asn1->offset - saved_offset;
1243 dissect_tcap_param(asn1, seq_subtree, len);
1247 dissect_tcap_eoc(asn1, seq_subtree);
1253 dissect_tcap_eoc(asn1, subtree);
1256 proto_item_set_len(item, asn1->offset - orig_offset);
1260 dissect_tcap_re(ASN1_SCK *asn1, proto_tree *tree)
1262 guint tag, len, comp_len;
1263 guint orig_offset, saved_offset;
1265 proto_tree *subtree;
1266 gboolean comp_def_len, def_len;
1269 orig_offset = asn1->offset;
1270 saved_offset = asn1->offset;
1271 asn1_id_decode1(asn1, &tag);
1274 proto_tree_add_text(tree, asn1->tvb, saved_offset, -1, "Component");
1276 subtree = proto_item_add_subtree(item, ett_component);
1278 proto_tree_add_uint_format(subtree, hf_tcap_tag, asn1->tvb,
1279 saved_offset, asn1->offset - saved_offset,
1280 tag, "Return Error Type Tag");
1282 dissect_tcap_len(asn1, subtree, &comp_def_len, &comp_len);
1286 comp_len = tcap_find_eoc(asn1);
1289 saved_offset = asn1->offset;
1291 dissect_tcap_invokeId(asn1, subtree);
1293 #define TC_LOCAL_ERR_CODE_TAG 0x2
1294 #define TC_GBL_ERR_CODE_TAG 0x6
1295 if (tcap_check_tag(asn1, TC_LOCAL_ERR_CODE_TAG))
1298 dissect_tcap_tag(asn1, subtree, &tag, "Local Error Code Tag");
1300 else if (tcap_check_tag(asn1, TC_GBL_ERR_CODE_TAG))
1303 dissect_tcap_tag(asn1, subtree, &tag, "Global Error Code Tag");
1307 proto_tree_add_text(subtree, asn1->tvb, asn1->offset, comp_len,
1308 "Unknown Error Code");
1310 asn1->offset += comp_len;
1314 dissect_tcap_eoc(asn1, subtree);
1317 proto_item_set_len(item, asn1->offset - orig_offset);
1322 dissect_tcap_len(asn1, subtree, &def_len, &len);
1323 dissect_tcap_integer(asn1, subtree, len, "Error Code:");
1325 dissect_tcap_param(asn1, subtree, comp_len - (asn1->offset - saved_offset));
1329 dissect_tcap_eoc(asn1, subtree);
1332 proto_item_set_len(item, asn1->offset - orig_offset);
1338 dissect_tcap_reject(ASN1_SCK *asn1, proto_tree *tree)
1340 guint tag, comp_len;
1343 proto_tree *subtree;
1348 saved_offset = asn1->offset;
1349 asn1_id_decode1(asn1, &tag);
1351 item = proto_tree_add_text(tree, asn1->tvb, saved_offset, -1, "Component");
1353 subtree = proto_item_add_subtree(item, ett_component);
1355 proto_tree_add_uint_format(subtree, hf_tcap_tag, asn1->tvb,
1356 saved_offset, asn1->offset - saved_offset,
1357 tag, "Reject Type Tag");
1359 dissect_tcap_len(asn1, subtree, &def_len, &comp_len);
1361 dissect_tcap_invokeId(asn1, subtree);
1363 dissect_tcap_problem(asn1, subtree);
1367 dissect_tcap_eoc(asn1, subtree);
1370 proto_item_set_len(item, asn1->offset - saved_offset);
1374 dissect_ansi_tcap_next_tvb(ASN1_SCK *asn1, guint len, proto_tree *tree)
1379 gboolean flag = TRUE;
1381 proto_item *item, *tag_item;
1382 proto_tree *subtree, *tag_subtree;
1386 if (lock_info_col) col_set_fence(g_pinfo->cinfo, COL_INFO);
1388 next_tvb = tvb_new_subset(asn1->tvb, asn1->offset, len, len);
1390 /* process components data */
1391 if (!dissector_try_port(tcap_ansi_ssn_dissector_table, g_pinfo->match_port, next_tvb, g_pinfo, g_tcap_tree))
1395 saved_offset = asn1->offset;
1396 ret = asn1_id_decode1(asn1, &tag);
1399 * verify tag type is known
1403 case ANSI_TC_INVOKE_L :
1406 case ANSI_TC_REJECT :
1407 case ANSI_TC_INVOKE_N :
1419 item = proto_tree_add_text(tree, asn1->tvb, saved_offset, -1, "Components");
1420 subtree = proto_item_add_subtree(item, ett_component);
1424 case ANSI_TC_INVOKE_L :
1425 tag_item = proto_tree_add_uint_format(subtree, hf_tcap_tag, asn1->tvb, saved_offset,
1426 asn1->offset - saved_offset, tag, "Invoke(Last)");
1427 dissect_tcap_len(asn1, subtree, &def_len, &len);
1428 tag_subtree = proto_item_add_subtree(tag_item, ett_component);
1430 dissect_ansi_tcap_invoke(asn1, tag_subtree);
1433 tag_item = proto_tree_add_uint_format(subtree, hf_tcap_tag, asn1->tvb, saved_offset,
1434 asn1->offset - saved_offset, tag, "Return Result(Last)");
1435 dissect_tcap_len(asn1, subtree, &def_len, &len);
1436 tag_subtree = proto_item_add_subtree(tag_item, ett_component);
1438 dissect_ansi_tcap_rr(asn1, tag_subtree);
1441 tag_item = proto_tree_add_uint_format(subtree, hf_tcap_tag, asn1->tvb, saved_offset,
1442 asn1->offset - saved_offset, tag, "Return Error");
1443 dissect_tcap_len(asn1, subtree, &def_len, &len);
1444 tag_subtree = proto_item_add_subtree(tag_item, ett_component);
1446 dissect_ansi_tcap_re(asn1, tag_subtree);
1448 case ANSI_TC_REJECT :
1449 tag_item = proto_tree_add_uint_format(subtree, hf_tcap_tag, asn1->tvb, saved_offset,
1450 asn1->offset - saved_offset, tag, "Reject");
1451 dissect_tcap_len(asn1, subtree, &def_len, &len);
1452 tag_subtree = proto_item_add_subtree(tag_item, ett_component);
1454 dissect_ansi_tcap_reject(asn1, tag_subtree);
1456 case ANSI_TC_INVOKE_N :
1457 tag_item = proto_tree_add_uint_format(subtree, hf_tcap_tag, asn1->tvb, saved_offset,
1458 asn1->offset - saved_offset, tag, "Invoke(Not Last)");
1459 dissect_tcap_len(asn1, subtree, &def_len, &len);
1460 tag_subtree = proto_item_add_subtree(tag_item, ett_component);
1462 dissect_ansi_tcap_invoke(asn1, tag_subtree);
1465 tag_item = proto_tree_add_uint_format(subtree, hf_tcap_tag, asn1->tvb, saved_offset,
1466 asn1->offset - saved_offset, tag, "Return Result(Not Last)");
1467 dissect_tcap_len(asn1, subtree, &def_len, &len);
1468 tag_subtree = proto_item_add_subtree(tag_item, ett_component);
1470 dissect_ansi_tcap_rr(asn1, tag_subtree);
1474 proto_item_set_len(item, asn1->offset - saved_offset);
1480 /* No sub-dissection occured, treat it as raw data */
1481 call_dissector(data_handle, next_tvb, g_pinfo, g_tcap_tree);
1486 dissect_tcap_components(ASN1_SCK *asn1, proto_tree *tcap_tree)
1488 proto_tree *subtree;
1489 proto_item *comps_item;
1490 guint saved_offset, comps_start;
1491 guint len, comp_len;
1493 gboolean comps_def_len, def_len;
1498 if (tvb_length_remaining(asn1->tvb, asn1->offset) <= 0)
1503 comps_start = asn1->offset;
1504 saved_offset = asn1->offset;
1505 ret = asn1_id_decode1(asn1, &tag);
1507 if (ST_ITU_CMP_TAG != tag)
1509 asn1->offset = saved_offset;
1514 proto_tree_add_text(tcap_tree, asn1->tvb,
1515 saved_offset, -1, "Components Portion");
1517 subtree = proto_item_add_subtree(comps_item, ett_comps_portion);
1519 proto_tree_add_uint_format(subtree, hf_tcap_tag, asn1->tvb, saved_offset,
1520 asn1->offset - saved_offset, tag, "Component Portion Tag");
1522 dissect_tcap_len(asn1, subtree, &comps_def_len, &len);
1526 proto_item_set_len(comps_item, (asn1->offset - comps_start) + len);
1529 if (lock_info_col) col_set_fence(g_pinfo->cinfo, COL_INFO);
1531 /* call next dissector for EACH component */
1534 (comps_def_len ? 0 : TCAP_EOC_LEN) +
1535 (g_tcap_ends_def_len ? 0 : TCAP_EOC_LEN);
1537 while (tvb_length_remaining(asn1->tvb, asn1->offset) > keep_len)
1539 /* peek at tag and length */
1540 saved_offset = asn1->offset;
1541 ret = asn1_id_decode1(asn1, &tag);
1545 ret = asn1_length_decode(asn1, &def_len, &comp_len);
1549 comp_len += (asn1->offset - saved_offset);
1553 comp_len = (asn1->offset - saved_offset) + tcap_find_eoc(asn1) + TCAP_EOC_LEN;
1556 next_tvb = tvb_new_subset(asn1->tvb, saved_offset, comp_len, comp_len);
1557 asn1->offset = saved_offset;
1559 /* process component data */
1560 if (dissector_try_port(tcap_itu_ssn_dissector_table, g_pinfo->match_port, next_tvb, g_pinfo, g_tcap_tree))
1562 proto_tree_add_text(subtree, asn1->tvb, asn1->offset, comp_len, "Component");
1564 asn1->offset += comp_len;
1570 case TCAP_COMP_INVOKE :
1571 dissect_tcap_invoke(asn1, subtree);
1573 case TCAP_COMP_RRL :
1574 dissect_tcap_rr(asn1, subtree, "Return Result(Last) Type Tag");
1577 dissect_tcap_re(asn1, subtree);
1579 case TCAP_COMP_REJECT :
1580 dissect_tcap_reject(asn1, subtree);
1582 case TCAP_COMP_RRN :
1583 /* same definition as RRL */
1584 dissect_tcap_rr(asn1, subtree, "Return Result(Not Last) Type Tag");
1587 /* treat it as raw data */
1588 call_dissector(data_handle, next_tvb, g_pinfo, g_tcap_tree);
1596 dissect_tcap_eoc(asn1, subtree);
1598 proto_item_set_len(comps_item, asn1->offset - comps_start);
1604 /* dissect dialog portion */
1606 dissect_tcap_dlg_protocol_version(ASN1_SCK *asn1, proto_tree *tcap_tree, proto_item *ti)
1608 guint saved_offset = 0;
1614 #define TC_DLG_PROTO_VER_TAG 0x80
1615 if (tcap_check_tag(asn1, TC_DLG_PROTO_VER_TAG))
1617 saved_offset = asn1->offset;
1618 ret = asn1_id_decode1(asn1, &tag);
1619 proto_tree_add_uint_format(tcap_tree, hf_tcap_tag, asn1->tvb,
1620 saved_offset, asn1->offset - saved_offset, tag,
1621 "Protocol Version Tag: 0x%x", tag);
1623 dissect_tcap_len(asn1, tcap_tree, &def_len, &len);
1624 saved_offset = asn1->offset;
1626 proto_tree_add_bytes(tcap_tree, hf_tcap_bytes, asn1->tvb, saved_offset, len,
1627 (guchar*)(tvb_get_ptr(asn1->tvb, saved_offset, len)));
1628 asn1->offset += len;
1635 dissect_tcap_dlg_application_context_name(ASN1_SCK *asn1, proto_tree *tcap_tree)
1637 guint saved_offset = 0;
1638 guint name_len, len, len2;
1644 saved_offset = asn1->offset;
1645 ret = asn1_id_decode1(asn1, &tag);
1646 proto_tree_add_uint_format(tcap_tree, hf_tcap_tag, asn1->tvb, saved_offset, asn1->offset - saved_offset, tag,
1647 "Application Context Name Tag: 0x%x", tag);
1649 dissect_tcap_len(asn1, tcap_tree, &def_len, &name_len);
1651 saved_offset = asn1->offset;
1652 ret = asn1_oid_decode (asn1, &oid, &len, &len2);
1653 proto_tree_add_bytes(tcap_tree, hf_tcap_app_con_name, asn1->tvb, saved_offset, len2, tvb_get_ptr(asn1->tvb, saved_offset, len2));
1654 if (ret == ASN1_ERR_NOERROR) g_free(oid);
1658 /* for Application Context Name Tag */
1659 dissect_tcap_eoc(asn1, tcap_tree);
1666 dissect_tcap_dlg_result(ASN1_SCK *asn1, proto_tree *tree)
1668 guint tag, rtag_len, itag_len;
1669 guint saved_offset = 0;
1673 gboolean rtag_def_len;
1676 dissect_tcap_tag(asn1, tree, &tag, "Result Tag");
1678 dissect_tcap_len(asn1, tree, &rtag_def_len, &rtag_len);
1681 dissect_tcap_tag(asn1, tree, &tag, "Integer Tag");
1683 dissect_tcap_len(asn1, tree, &def_len, &itag_len);
1685 saved_offset = asn1->offset;
1686 asn1_int32_value_decode(asn1, itag_len, &value);
1690 case 0x00: str = "Accepted"; break;
1691 case 0x01: str = "Reject-permanent"; break;
1692 default: str = "Unknown value"; break;
1695 proto_tree_add_int_format(tree, hf_tcap_int, asn1->tvb, saved_offset, asn1->offset - saved_offset,
1696 value, "%s %d", str, value);
1700 /* for Result Tag */
1701 dissect_tcap_eoc(asn1, tree);
1708 dissect_tcap_dlg_result_src_diag(ASN1_SCK *asn1, proto_tree *tree)
1710 guint saved_offset = 0;
1716 gboolean serv_def_len;
1717 gboolean diag_def_len;
1720 dissect_tcap_tag(asn1, tree, &tag, "Result Source Diagnostic Tag");
1722 dissect_tcap_len(asn1, tree, &diag_def_len, &len);
1724 #define TC_DIAG_SERV_USER_TAG 0xa1
1725 #define TC_DIAG_SERV_PROV_TAG 0xa2
1726 if (tcap_check_tag(asn1, TC_DIAG_SERV_USER_TAG))
1729 dissect_tcap_tag(asn1, tree, &tag, "Dialogue Service User Tag");
1732 else if (tcap_check_tag(asn1, TC_DIAG_SERV_PROV_TAG))
1735 dissect_tcap_tag(asn1, tree, &tag, "Dialogue Service Provider Tag");
1740 proto_tree_add_text(tree, asn1->tvb, asn1->offset, len,
1741 "Unknown Result Source Diagnostic");
1743 asn1->offset += len;
1747 dissect_tcap_len(asn1, tree, &serv_def_len, &len);
1750 dissect_tcap_tag(asn1, tree, &tag, "Integer Tag");
1752 dissect_tcap_len(asn1, tree, &def_len, &len);
1754 saved_offset = asn1->offset;
1755 asn1_int32_value_decode(asn1, len, &value);
1761 case 0x00: str = "Null"; break;
1762 case 0x01: str = "No reason given"; break;
1763 case 0x02: str = "Application Context Name not supplied"; break;
1764 default: str = "Unknown value"; break;
1771 case 0x00: str = "Null"; break;
1772 case 0x01: str = "No reason given"; break;
1773 case 0x02: str = "No common dialogue portion"; break;
1774 default: str = "Unknown value"; break;
1778 proto_tree_add_int_format(tree, hf_tcap_int, asn1->tvb, saved_offset, asn1->offset - saved_offset,
1779 value, "%s %d", str, value);
1783 /* for Dialogue Service User/Provider Tag */
1784 dissect_tcap_eoc(asn1, tree);
1789 /* for Result Source Diagnostic Tag */
1790 dissect_tcap_eoc(asn1, tree);
1797 dissect_tcap_dlg_user_info(ASN1_SCK *asn1, proto_tree *tree)
1800 guint saved_offset = 0;
1802 gboolean user_info_def_len;
1804 #define TC_USR_INFO_TAG 0xbe
1805 if (tcap_check_tag(asn1, TC_USR_INFO_TAG))
1808 dissect_tcap_tag(asn1, tree, &tag, "User Info Tag");
1809 dissect_tcap_len(asn1, tree, &user_info_def_len, &len);
1811 #define TC_EXT_TAG 0x28
1812 if (tcap_check_tag(asn1, TC_EXT_TAG))
1814 saved_offset = asn1->offset;
1815 asn1_id_decode1(asn1, &tag);
1816 proto_tree_add_uint_format(tree, hf_tcap_length, asn1->tvb, saved_offset, asn1->offset - saved_offset,
1817 tag, "External Tag: 0x%x", tag);
1819 dissect_tcap_len(asn1, tree, &def_len, &len);
1822 proto_tree_add_text(tree, asn1->tvb, asn1->offset, len, "Parameter Data");
1823 asn1->offset += len;
1825 if (!user_info_def_len)
1827 /* for User Information Tag */
1828 dissect_tcap_eoc(asn1, tree);
1836 dissect_tcap_dlg_req(ASN1_SCK *asn1, proto_tree *tcap_tree)
1838 proto_tree *subtree;
1839 guint saved_offset = 0;
1843 proto_item *req_item;
1844 guint req_start = asn1->offset;
1847 /* dissect dialog portion */
1848 saved_offset = asn1->offset;
1849 ret = asn1_id_decode1(asn1, &tag);
1850 req_item = proto_tree_add_text(tcap_tree, asn1->tvb, saved_offset, -1, "Dialogue Request");
1851 subtree = proto_item_add_subtree(req_item, ett_dlg_req);
1852 proto_tree_add_uint(subtree, hf_tcap_dlg_type, asn1->tvb, saved_offset, asn1->offset - saved_offset, tag);
1854 dissect_tcap_len(asn1, subtree, &def_len, &len);
1856 dissect_tcap_dlg_protocol_version(asn1, subtree, NULL);
1858 dissect_tcap_dlg_application_context_name(asn1, subtree);
1860 dissect_tcap_dlg_user_info(asn1, subtree);
1862 /* decode end of sequence */
1866 /* for Dialogue Request Tag */
1867 dissect_tcap_eoc(asn1, subtree);
1870 proto_item_set_len(req_item, asn1->offset - req_start);
1876 dissect_tcap_dlg_rsp(ASN1_SCK *asn1, proto_tree *tcap_tree)
1878 proto_tree *subtree;
1879 guint saved_offset = 0;
1883 proto_item *req_item;
1884 guint req_start = asn1->offset;
1887 /* dissect dialog portion */
1888 saved_offset = asn1->offset;
1889 ret = asn1_id_decode1(asn1, &tag);
1890 req_item = proto_tree_add_text(tcap_tree, asn1->tvb, saved_offset, -1, "Dialogue Response");
1891 subtree = proto_item_add_subtree(req_item, ett_dlg_rsp);
1892 proto_tree_add_uint(subtree, hf_tcap_dlg_type, asn1->tvb, saved_offset, asn1->offset - saved_offset, tag);
1894 dissect_tcap_len(asn1, subtree, &def_len, &len);
1896 dissect_tcap_dlg_protocol_version(asn1, subtree, NULL);
1898 dissect_tcap_dlg_application_context_name(asn1, subtree);
1901 dissect_tcap_dlg_result(asn1, subtree);
1903 /* result source diag */
1904 dissect_tcap_dlg_result_src_diag(asn1, subtree);
1906 dissect_tcap_dlg_user_info(asn1, subtree);
1910 /* for Dialogue Response Tag */
1911 dissect_tcap_eoc(asn1, subtree);
1914 proto_item_set_len(req_item, asn1->offset - req_start);
1920 dissect_tcap_dlg_abrt(ASN1_SCK *asn1, proto_tree *tree)
1922 proto_tree *subtree;
1923 guint saved_offset = 0;
1927 proto_item *req_item;
1930 gboolean def_len, abort_def_len;
1932 /* dissect dialog pabort portion */
1933 saved_offset = asn1->offset;
1934 ret = asn1_id_decode1(asn1, &tag);
1935 req_item = proto_tree_add_text(tree, asn1->tvb, saved_offset, -1, "Dialogue Abort");
1936 subtree = proto_item_add_subtree(req_item, ett_dlg_abort );
1937 proto_tree_add_uint(subtree, hf_tcap_dlg_type, asn1->tvb, saved_offset, asn1->offset - saved_offset, tag);
1939 dissect_tcap_len(asn1, subtree, &abort_def_len, &len);
1942 dissect_tcap_tag(asn1, subtree, &tag, "Abort Source Tag");
1943 dissect_tcap_len(asn1, subtree, &def_len, &len);
1945 saved_offset = asn1->offset;
1946 asn1_int32_value_decode(asn1, len, &value);
1950 case 0x00: str = "Dialogue Service User"; break;
1951 case 0x01: str = "Dialogue Service Provider"; break;
1952 default: str = "Unknown value"; break;
1955 proto_tree_add_int_format(subtree, hf_tcap_int, asn1->tvb, saved_offset, asn1->offset - saved_offset,
1956 value, "Abort Source: %s %d", str, value);
1958 dissect_tcap_dlg_user_info(asn1, subtree);
1962 /* for Dialogue Abort Tag */
1963 dissect_tcap_eoc(asn1, subtree);
1970 dissect_tcap_dialog_portion(ASN1_SCK *asn1, proto_tree *tcap_tree, proto_item *ti)
1972 proto_tree *subtree;
1973 guint saved_offset = 0;
1977 proto_item *dlg_item;
1978 guint dlg_start = asn1->offset;
1979 gboolean def_len, ext_tag_def_len, portion_def_len;
1981 if (tvb_length_remaining(asn1->tvb, asn1->offset) <= 0)
1986 /* dissect dialog portion */
1987 saved_offset = asn1->offset;
1988 ret = asn1_id_decode1(asn1, &tag);
1990 /* error handling */
1991 if (ST_ITU_DLG_TAG != tag)
1993 asn1->offset = saved_offset;
1998 proto_tree_add_text(tcap_tree, asn1->tvb, saved_offset, -1, "Dialogue Portion");
2000 subtree = proto_item_add_subtree(dlg_item, ett_dlg_portion);
2002 proto_tree_add_uint_format(subtree, hf_tcap_tag, asn1->tvb,
2003 saved_offset, asn1->offset - saved_offset, tag, "Dialogue Portion Tag");
2005 dissect_tcap_len(asn1, subtree, &portion_def_len, &len);
2007 if (portion_def_len)
2009 proto_item_set_len(dlg_item, len);
2012 ext_tag_def_len = FALSE;
2013 saved_offset = asn1->offset;
2014 ret = asn1_id_decode1(asn1, &tag);
2015 #define TC_EXT_TAG 0x28
2016 if (TC_EXT_TAG != tag)
2018 asn1->offset = saved_offset;
2022 proto_tree_add_uint_format(subtree, hf_tcap_length, asn1->tvb,
2023 saved_offset, asn1->offset - saved_offset, tag,
2024 "External Tag: 0x%x", tag);
2026 dissect_tcap_len(asn1, subtree, &ext_tag_def_len, &len);
2029 saved_offset = asn1->offset;
2030 ret = asn1_id_decode1(asn1, &tag);
2031 #define TC_OID_TAG 0x06
2032 if (TC_OID_TAG != tag)
2034 asn1->offset = saved_offset;
2038 proto_tree_add_uint_format(subtree, hf_tcap_tag, asn1->tvb,
2039 saved_offset, asn1->offset - saved_offset, tag,
2040 "Object Identifier Tag");
2042 dissect_tcap_len(asn1, subtree, &def_len, &len);
2044 saved_offset = asn1->offset;
2046 proto_tree_add_bytes(subtree, hf_tcap_bytes, asn1->tvb, saved_offset, len,
2047 (guchar*)(tvb_get_ptr(asn1->tvb, saved_offset, len)));
2049 asn1->offset += len;
2052 saved_offset = asn1->offset;
2053 ret = asn1_id_decode1(asn1, &tag);
2055 proto_tree_add_uint_format(subtree, hf_tcap_tag, asn1->tvb,
2056 saved_offset, asn1->offset - saved_offset, tag,
2057 "Single-ASN.1-type Tag");
2059 dissect_tcap_len(asn1, subtree, &def_len, &len);
2061 proto_item_set_len(dlg_item, asn1->offset - dlg_start);
2064 saved_offset = asn1->offset;
2065 ret = asn1_id_decode1(asn1, &tag);
2066 asn1->offset = saved_offset;
2071 dissect_tcap_dlg_req(asn1, subtree);
2074 dissect_tcap_dlg_rsp(asn1, subtree);
2077 dissect_tcap_dlg_abrt(asn1, subtree);
2083 /* decode end of sequence */
2087 dissect_tcap_eoc(asn1, subtree);
2090 if (!ext_tag_def_len)
2092 dissect_tcap_eoc(asn1, subtree);
2095 if (!portion_def_len)
2097 dissect_tcap_eoc(asn1, subtree);
2100 proto_item_set_len(dlg_item, asn1->offset - dlg_start);
2105 /* dissect reason */
2107 dissect_tcap_abort_reason(ASN1_SCK *asn1, proto_tree *tcap_tree)
2109 guint saved_offset = 0;
2111 proto_tree *subtree;
2117 #define TC_PABRT_REASON_TAG 0x4a
2118 tag = TC_PABRT_REASON_TAG;
2119 if (tcap_check_tag(asn1, tag))
2121 saved_offset = asn1->offset;
2123 proto_tree_add_text(tcap_tree, asn1->tvb, saved_offset, -1, "PAbort Cause");
2125 subtree = proto_item_add_subtree(item, ett_reason);
2128 dissect_tcap_tag(asn1, subtree, &tag, "PAbort Cause Tag");
2129 dissect_tcap_len(asn1, subtree, &def_len, &len);
2131 proto_item_set_len(item, (asn1->offset - saved_offset) + len);
2133 saved_offset = asn1->offset;
2134 asn1_int32_value_decode(asn1, len, &value);
2138 case 0x00: str = "Unrecognized Message Type"; break;
2139 case 0x01: str = "Unrecognized Transaction ID"; break;
2140 case 0x02: str = "Badly Formatted Transaction Portion"; break;
2141 case 0x03: str = "Incorrect Transaction Portion"; break;
2142 case 0x04: str = "Resource Limitation"; break;
2148 proto_tree_add_text(subtree, asn1->tvb,
2149 saved_offset, asn1->offset - saved_offset, "Cause Value %s (%d)",
2156 /* dissect each type of message */
2159 dissect_tcap_unidirectional(ASN1_SCK *asn1, proto_tree *tcap_tree)
2162 dissect_tcap_dialog_portion(asn1, tcap_tree, NULL);
2164 dissect_tcap_components(asn1, tcap_tree);
2168 dissect_tcap_begin(ASN1_SCK *asn1, proto_tree *tcap_tree, proto_item *ti)
2171 dissect_tcap_tid(asn1, tcap_tree, ti, ST_TID_SOURCE);
2173 dissect_tcap_dialog_portion(asn1, tcap_tree, NULL);
2175 dissect_tcap_components(asn1, tcap_tree);
2179 dissect_tcap_continue(ASN1_SCK *asn1, proto_tree *tcap_tree, proto_item *ti)
2182 dissect_tcap_tid(asn1, tcap_tree, ti, ST_TID_SOURCE);
2184 dissect_tcap_tid(asn1, tcap_tree, ti, ST_TID_DEST);
2186 dissect_tcap_dialog_portion(asn1, tcap_tree, NULL);
2188 dissect_tcap_components(asn1, tcap_tree);
2193 dissect_tcap_end(ASN1_SCK *asn1, proto_tree *tcap_tree, proto_item *ti)
2196 dissect_tcap_tid(asn1, tcap_tree, ti, ST_TID_DEST);
2198 dissect_tcap_dialog_portion(asn1, tcap_tree, NULL);
2200 dissect_tcap_components(asn1, tcap_tree);
2204 dissect_tcap_abort(ASN1_SCK *asn1, proto_tree *tree, proto_item *ti)
2207 dissect_tcap_tid(asn1, tree, ti, ST_TID_DEST);
2209 dissect_tcap_abort_reason(asn1, tree);
2211 dissect_tcap_dialog_portion(asn1, tree, NULL);
2216 dissect_tcap_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tcap_tree)
2222 guint saved_offset = 0;
2226 asn1_open(&asn1, tvb, offset);
2228 asn1_id_decode1(&asn1, &msg_type_tag);
2230 str = match_strval(msg_type_tag, msg_type_strings);
2234 proto_tree_add_text(tcap_tree, asn1.tvb, offset, -1, "Unknown message type, ignoring");
2238 if (check_col(pinfo->cinfo, COL_INFO))
2240 col_set_str(pinfo->cinfo, COL_INFO, str);
2241 col_append_str(pinfo->cinfo, COL_INFO, " ");
2244 proto_tree_add_uint_hidden(tcap_tree, hf_tcap_ssn, asn1.tvb, offset,
2245 0, pinfo->match_port); /* len -1 is unacceptable */
2247 ti = proto_tree_add_uint(tcap_tree, hf_tcap_message_type, asn1.tvb, offset, asn1.offset - saved_offset,
2250 dissect_tcap_len(&asn1, tcap_tree, &g_tcap_ends_def_len, &len);
2252 switch(msg_type_tag)
2254 case ST_MSG_TYP_UNI:
2255 dissect_tcap_unidirectional(&asn1, tcap_tree);
2257 case ST_MSG_TYP_BGN:
2258 dissect_tcap_begin(&asn1, tcap_tree, ti);
2260 case ST_MSG_TYP_CNT:
2261 dissect_tcap_continue(&asn1, tcap_tree, ti);
2263 case ST_MSG_TYP_END:
2264 dissect_tcap_end(&asn1, tcap_tree, ti);
2266 case ST_MSG_TYP_PABT:
2267 dissect_tcap_abort(&asn1, tcap_tree, ti);
2270 proto_tree_add_text(tcap_tree, asn1.tvb, offset, -1,
2271 "Message type not handled, ignoring");
2275 if (!g_tcap_ends_def_len)
2277 dissect_tcap_eoc(&asn1, tcap_tree);
2280 asn1_close(&asn1, &saved_offset);
2284 dissect_ansi_tcap_components(ASN1_SCK *asn1, proto_tree *tcap_tree)
2286 proto_tree *subtree;
2287 guint saved_offset = 0;
2291 proto_item *cmp_item;
2292 guint cmp_start = asn1->offset;
2295 saved_offset = asn1->offset;
2296 ret = asn1_id_decode1(asn1, &tag);
2298 if (ST_ANSI_CMP_TAG != tag)
2300 asn1->offset = saved_offset;
2304 cmp_item = proto_tree_add_text(tcap_tree, asn1->tvb, saved_offset, -1, "Components Portion");
2306 subtree = proto_item_add_subtree(cmp_item, ett_comps_portion);
2308 proto_tree_add_uint_format(subtree, hf_tcap_tag, asn1->tvb, saved_offset, asn1->offset - saved_offset, tag,
2309 "Component Sequence Identifier");
2311 dissect_tcap_len(asn1, tcap_tree, &def_len, &len);
2313 /* call next dissector */
2315 dissect_ansi_tcap_next_tvb(asn1, len, subtree);
2317 proto_item_set_len(cmp_item, asn1->offset - cmp_start);
2323 dissect_ansi_tcap_unidirectional(ASN1_SCK *asn1, proto_tree *tcap_tree)
2325 guint saved_offset = 0;
2329 proto_item *trans_item;
2330 guint trans_start = asn1->offset;
2333 saved_offset = asn1->offset;
2334 ret = asn1_id_decode1(asn1, &tag);
2336 if (ST_ANSI_TID_TAG != tag)
2338 asn1->offset = saved_offset;
2342 trans_item = proto_tree_add_text(tcap_tree, asn1->tvb, saved_offset, -1, "Transaction Portion");
2344 dissect_tcap_len(asn1, tcap_tree, &def_len, &len);
2351 proto_item_set_len(trans_item, asn1->offset - trans_start);
2353 dissect_ansi_tcap_components(asn1, tcap_tree);
2359 dissect_ansi_tcap_qwp_qwop(ASN1_SCK *asn1, proto_tree *tcap_tree, proto_item *ti)
2361 proto_tree *subtree;
2362 guint saved_offset = 0;
2366 proto_item *trans_item;
2367 guint trans_start = asn1->offset;
2372 saved_offset = asn1->offset;
2373 ret = asn1_id_decode1(asn1, &tag);
2375 if (ST_ANSI_TID_TAG != tag)
2377 asn1->offset = saved_offset;
2381 trans_item = proto_tree_add_text(tcap_tree, asn1->tvb, saved_offset, -1, "Transaction Portion");
2382 subtree = proto_item_add_subtree(trans_item, ett_dlg_portion);
2384 proto_tree_add_uint_format(subtree, hf_tcap_tag, asn1->tvb, saved_offset, asn1->offset - saved_offset, tag,
2385 "Originating Transaction ID Identifier");
2387 dissect_tcap_len(asn1, tcap_tree, &def_len, &len);
2394 saved_offset = asn1->offset;
2395 ret = asn1_string_value_decode(asn1, len, &poctets);
2397 memcpy(&val, poctets, len);
2398 ti = proto_tree_add_uint(subtree, hf_tcap_id, asn1->tvb, saved_offset, asn1->offset - saved_offset, val);
2401 if (check_col(g_pinfo->cinfo, COL_INFO))
2402 col_append_fstr(g_pinfo->cinfo, COL_INFO, "otid(%x) ", val);
2404 proto_item_set_len(trans_item, asn1->offset - trans_start);
2406 dissect_ansi_tcap_components(asn1, tcap_tree);
2412 dissect_ansi_tcap_abort(ASN1_SCK *asn1, proto_tree *tcap_tree, proto_item *ti)
2414 proto_tree *subtree;
2415 guint saved_offset = 0;
2419 proto_item *trans_item;
2420 guint trans_start = asn1->offset;
2427 saved_offset = asn1->offset;
2428 ret = asn1_id_decode1(asn1, &tag);
2430 if (ST_ANSI_TID_TAG != tag)
2432 asn1->offset = saved_offset;
2437 proto_tree_add_text(tcap_tree, asn1->tvb,
2438 saved_offset, -1, "Transaction Portion");
2440 subtree = proto_item_add_subtree(trans_item, ett_dlg_portion);
2442 proto_tree_add_uint_format(subtree, hf_tcap_tag, asn1->tvb,
2443 saved_offset, asn1->offset - saved_offset, tag,
2444 "Responding Transaction ID Identifier");
2446 dissect_tcap_len(asn1, subtree, &def_len, &len);
2453 saved_offset = asn1->offset;
2454 ret = asn1_string_value_decode(asn1, len, &poctets);
2457 memcpy(&val, poctets, len);
2458 ti = proto_tree_add_uint(subtree, hf_tcap_id, asn1->tvb, saved_offset, asn1->offset - saved_offset, val);
2461 if (check_col(g_pinfo->cinfo, COL_INFO))
2462 col_append_fstr(g_pinfo->cinfo, COL_INFO, "rtid(%x) ", val);
2464 proto_item_set_len(trans_item, asn1->offset - trans_start);
2466 if (tvb_length_remaining(asn1->tvb, asn1->offset) <= 0)
2468 proto_tree_add_text(tcap_tree, asn1->tvb, asn1->offset, -1,
2469 "!!! Missing Component Portion !!!");
2474 saved_offset = asn1->offset;
2475 ret = asn1_id_decode1(asn1, &tag);
2477 #define ANSI_TC_PABRT_CAUSE_TAG 0xd7
2478 if (tag == ANSI_TC_PABRT_CAUSE_TAG)
2481 proto_tree_add_text(tcap_tree, asn1->tvb, saved_offset, -1, "P-Abort Portion");
2483 subtree = proto_item_add_subtree(trans_item, ett_dlg_abort);
2485 dissect_tcap_len(asn1, subtree, &def_len, &len);
2487 proto_item_set_len(trans_item, (asn1->offset - saved_offset) + len);
2489 saved_offset = asn1->offset;
2490 asn1_int32_value_decode(asn1, len, &value);
2494 case 1: str = "Unrecognized Package Type"; break;
2495 case 2: str = "Incorrect Transaction Portion"; break;
2496 case 3: str = "Badly Structured Transaction Portion"; break;
2497 case 4: str = "Unrecognized Transaction ID"; break;
2498 case 5: str = "Permission to Release"; break;
2499 case 6: str = "Resource Unavailable"; break;
2505 proto_tree_add_text(subtree, asn1->tvb,
2506 saved_offset, asn1->offset - saved_offset, "P-Abort Cause Value %s (%d)",
2509 #define ANSI_TC_UABRT_INFO_TAG 0xd8
2510 else if (tag == ANSI_TC_UABRT_INFO_TAG)
2513 proto_tree_add_text(tcap_tree, asn1->tvb, saved_offset, -1, "U-Abort Portion");
2515 subtree = proto_item_add_subtree(trans_item, ett_dlg_abort);
2517 dissect_tcap_len(asn1, subtree, &def_len, &len);
2520 dissect_tcap_integer(asn1, subtree, len, "User Abort Information:");
2528 dissect_ansi_tcap_rsp(ASN1_SCK *asn1, proto_tree *tcap_tree, proto_item *ti)
2530 proto_tree *subtree;
2531 guint saved_offset = 0;
2535 proto_item *trans_item;
2536 guint trans_start = asn1->offset;
2541 saved_offset = asn1->offset;
2542 ret = asn1_id_decode1(asn1, &tag);
2544 if (ST_ANSI_TID_TAG != tag)
2546 asn1->offset = saved_offset;
2550 trans_item = proto_tree_add_text(tcap_tree, asn1->tvb, saved_offset, -1, "Transaction Portion");
2551 subtree = proto_item_add_subtree(trans_item, ett_dlg_portion);
2553 proto_tree_add_uint_format(subtree, hf_tcap_tag, asn1->tvb, saved_offset, asn1->offset - saved_offset, tag,
2554 "Responding Transaction ID Identifier");
2556 dissect_tcap_len(asn1, tcap_tree, &def_len, &len);
2563 saved_offset = asn1->offset;
2564 ret = asn1_string_value_decode(asn1, len, &poctets);
2566 memcpy(&val, poctets, len);
2567 ti = proto_tree_add_uint(subtree, hf_tcap_id, asn1->tvb, saved_offset, asn1->offset - saved_offset, val);
2570 if (check_col(g_pinfo->cinfo, COL_INFO))
2571 col_append_fstr(g_pinfo->cinfo, COL_INFO, "rtid(%x) ", val);
2573 proto_item_set_len(trans_item, asn1->offset - trans_start);
2575 dissect_ansi_tcap_components(asn1, tcap_tree);
2581 dissect_ansi_tcap_cwp_cwop(ASN1_SCK *asn1, proto_tree *tcap_tree, proto_item *ti)
2583 proto_tree *subtree;
2584 guint saved_offset = 0;
2588 proto_item *trans_item;
2589 guint trans_start = asn1->offset;
2594 saved_offset = asn1->offset;
2595 ret = asn1_id_decode1(asn1, &tag);
2597 if (ST_ANSI_TID_TAG != tag)
2599 asn1->offset = saved_offset;
2603 trans_item = proto_tree_add_text(tcap_tree, asn1->tvb, saved_offset, -1, "Transaction Portion");
2604 subtree = proto_item_add_subtree(trans_item, ett_dlg_portion);
2606 proto_tree_add_uint_format(subtree, hf_tcap_tag, asn1->tvb, saved_offset, asn1->offset - saved_offset, tag,
2607 "Transaction ID Identifier");
2609 dissect_tcap_len(asn1, tcap_tree, &def_len, &len);
2616 saved_offset = asn1->offset;
2617 ret = asn1_string_value_decode(asn1, 4, &poctets);
2619 memcpy(&val, poctets, 4);
2620 ti = proto_tree_add_uint(subtree, hf_tcap_id, asn1->tvb, saved_offset, asn1->offset - saved_offset, val);
2623 if (check_col(g_pinfo->cinfo, COL_INFO))
2624 col_append_fstr(g_pinfo->cinfo, COL_INFO, "otid(%x) ", val);
2626 saved_offset = asn1->offset;
2627 ret = asn1_string_value_decode(asn1, 4, &poctets);
2629 memcpy(&val, poctets, 4);
2630 ti = proto_tree_add_uint(subtree, hf_tcap_id, asn1->tvb, saved_offset, asn1->offset - saved_offset, val);
2633 if (check_col(g_pinfo->cinfo, COL_INFO))
2634 col_append_fstr(g_pinfo->cinfo, COL_INFO, "rtid(%x) ", val);
2636 proto_item_set_len(trans_item, asn1->offset - trans_start);
2638 dissect_ansi_tcap_components(asn1, tcap_tree);
2644 dissect_ansi_tcap_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tcap_tree)
2650 guint saved_offset = 0;
2655 asn1_open(&asn1, tvb, offset);
2657 asn1_id_decode1(&asn1, &msg_type_tag);
2659 str = match_strval(msg_type_tag, ansi_msg_type_strings);
2663 proto_tree_add_text(tcap_tree, asn1.tvb, offset, -1, "Unknown message type, ignoring");
2667 if (check_col(pinfo->cinfo, COL_INFO))
2669 col_set_str(pinfo->cinfo, COL_INFO, str);
2670 col_append_str(pinfo->cinfo, COL_INFO, " ");
2673 proto_tree_add_uint_hidden(tcap_tree, hf_tcap_ssn, asn1.tvb, offset,
2674 0, pinfo->match_port); /* len -1 is unacceptable */
2676 ti = proto_tree_add_uint(tcap_tree, hf_ansi_tcap_message_type, asn1.tvb, offset, asn1.offset - saved_offset,
2679 dissect_tcap_len(&asn1, tcap_tree, &def_len, &len);
2681 switch(msg_type_tag)
2683 case ANSI_ST_MSG_TYP_UNI:
2684 dissect_ansi_tcap_unidirectional(&asn1, tcap_tree);
2686 case ANSI_ST_MSG_TYP_QWP:
2687 dissect_ansi_tcap_qwp_qwop(&asn1, tcap_tree, ti);
2689 case ANSI_ST_MSG_TYP_QWOP:
2690 dissect_ansi_tcap_qwp_qwop(&asn1, tcap_tree, ti);
2692 case ANSI_ST_MSG_TYP_RSP:
2693 dissect_ansi_tcap_rsp(&asn1, tcap_tree, ti);
2695 case ANSI_ST_MSG_TYP_CWP:
2696 dissect_ansi_tcap_cwp_cwop(&asn1, tcap_tree, ti);
2698 case ANSI_ST_MSG_TYP_CWOP:
2699 dissect_ansi_tcap_cwp_cwop(&asn1, tcap_tree, ti);
2701 case ANSI_ST_MSG_TYP_ABT:
2702 dissect_ansi_tcap_abort(&asn1, tcap_tree, ti);
2705 proto_tree_add_text(tcap_tree, asn1.tvb, offset, -1,
2706 "Message type not handled, ignoring");
2710 asn1_close(&asn1, &saved_offset);
2713 /* Code to actually dissect the packets */
2715 dissect_tcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2718 proto_tree *tcap_tree;
2722 if (check_col(pinfo->cinfo, COL_PROTOCOL))
2723 col_set_str(pinfo->cinfo, COL_PROTOCOL, "TCAP");
2725 /* In the interest of speed, if "tree" is NULL, don't do any
2726 * work not necessary to generate protocol tree items.
2730 ti = proto_tree_add_item(tree, proto_tcap, tvb, 0, -1, FALSE);
2731 tcap_tree = proto_item_add_subtree(ti, ett_tcap);
2734 if (tcap_standard == ITU_TCAP_STANDARD)
2736 dissect_tcap_message(tvb, pinfo, tcap_tree);
2740 dissect_ansi_tcap_message(tvb, pinfo, tcap_tree);
2746 /* Register the protocol with Ethereal */
2748 /* this format is require because a script is used to build the C function
2749 that calls all the protocol registration.
2752 proto_register_tcap(void)
2755 /* Setup list of header fields See Section 1.6.1 for details*/
2756 static hf_register_info hf[] = {
2757 /*{ &hf_tcap_FIELDABBREV,
2758 { "FIELDNAME", "PROTOABBREV.FIELDABBREV",
2759 FIELDTYPE, FIELDBASE, FIELDCONVERT, BITMASK,
2763 { "Tag", "tcap.msgtype",
2764 FT_UINT8, BASE_HEX, NULL, 0,
2768 { "Length", "tcap.len",
2769 FT_UINT8, BASE_HEX, NULL, 0,
2773 { "Value", "tcap.id",
2774 FT_UINT8, BASE_HEX, NULL, 0,
2777 { &hf_tcap_message_type,
2778 { "Message Type", "tcap.msgtype",
2779 FT_UINT8, BASE_HEX, VALS(msg_type_strings), 0,
2782 { &hf_ansi_tcap_message_type,
2783 { "Message Type", "tcap.msgtype",
2784 FT_UINT8, BASE_HEX, VALS(ansi_msg_type_strings), 0,
2788 { "Transaction Id", "tcap.tid",
2789 FT_UINT32, BASE_DEC, VALS(tid_strings), 0,
2793 { "Called or Calling SubSystem Number", "tcap.ssn",
2794 FT_UINT8, BASE_DEC, 0x0, 0x0,
2797 { &hf_tcap_dlg_type,
2798 { "Dialogue Type", "tcap.dlgtype",
2799 FT_UINT8, BASE_HEX, VALS(dlg_type_strings), 0,
2802 { &hf_tcap_app_con_name,
2803 { "Application Context Name", "tcap.dlg.appconname",
2804 FT_BYTES, BASE_HEX, 0, 0,
2808 { "Binary Data", "tcap.data",
2809 FT_BYTES, BASE_HEX, 0, 0,
2813 { "Integer Data", "tcap.data",
2814 FT_INT32, BASE_DEC, 0, 0,
2819 /* Setup protocol subtree array */
2820 static gint *ett[] = {
2837 static enum_val_t tcap_options[] = {
2838 { "itu", "ITU", ITU_TCAP_STANDARD },
2839 { "ansi", "ANSI", ANSI_TCAP_STANDARD },
2843 module_t *tcap_module;
2845 /* Register the protocol name and description */
2846 proto_tcap = proto_register_protocol("Transaction Capabilities Application Part",
2849 /* Required function calls to register the header fields and subtrees used */
2850 proto_register_field_array(proto_tcap, hf, array_length(hf));
2851 proto_register_subtree_array(ett, array_length(ett));
2853 tcap_module = prefs_register_protocol(proto_tcap, NULL);
2855 prefs_register_enum_preference(tcap_module, "standard", "TCAP standard",
2856 "The SS7 standard used in TCAP packets",
2857 (gint *)&tcap_standard, tcap_options, FALSE);
2859 prefs_register_bool_preference(tcap_module, "lock_info_col", "Lock Info column",
2860 "Always show TCAP in Info column",
2863 /* we will fake a ssn subfield which has the same value obtained from sccp */
2864 tcap_itu_ssn_dissector_table = register_dissector_table("tcap.itu_ssn", "ITU TCAP SSN", FT_UINT8, BASE_DEC);
2865 tcap_ansi_ssn_dissector_table = register_dissector_table("tcap.ansi_ssn", "ANSI TCAP SSN", FT_UINT8, BASE_DEC);
2869 /* If this dissector uses sub-dissector registration add a registration routine.
2870 This format is required because a script is used to find these routines and
2871 create the code that calls these routines.
2874 proto_reg_handoff_tcap(void)
2876 dissector_handle_t tcap_handle;
2878 tcap_handle = create_dissector_handle(dissect_tcap,
2881 dissector_add("sccp.ssn", 5, tcap_handle); /* MAP*/
2882 dissector_add("sccp.ssn", 6, tcap_handle); /* HLR*/
2883 dissector_add("sccp.ssn", 7, tcap_handle); /* VLR */
2884 dissector_add("sccp.ssn", 8, tcap_handle); /* MSC */
2885 dissector_add("sccp.ssn", 9, tcap_handle); /* EIR */
2886 dissector_add("sccp.ssn", 10, tcap_handle); /* EIR */
2887 dissector_add("sccp.ssn", 11, tcap_handle); /* SMS/MC */
2888 dissector_add("sccp.ssn", 12, tcap_handle); /* IS41 OTAF */
2890 dissector_add("sua.ssn", 5, tcap_handle); /* MAP*/
2891 dissector_add("sua.ssn", 6, tcap_handle); /* HLR*/
2892 dissector_add("sua.ssn", 7, tcap_handle); /* VLR */
2893 dissector_add("sua.ssn", 8, tcap_handle); /* MSC */
2894 dissector_add("sua.ssn", 9, tcap_handle); /* EIR */
2895 dissector_add("sua.ssn", 10, tcap_handle); /* EIR */
2896 dissector_add("sua.ssn", 11, tcap_handle); /* SMS/MC */
2897 dissector_add("sua.ssn", 12, tcap_handle); /* IS41 OTAF */
2899 data_handle = find_dissector("data");