1 /* packet-inap-template.c
3 * Copyright 2004, Tim Endean <endeant@hotmail.com>
4 * Built from the gsm-map dissector Copyright 2004, Anders Broman <anders.broman@ericsson.com>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 * References: ETSI 300 374
33 #include <epan/packet.h>
34 #include <epan/prefs.h>
35 #include <epan/oids.h>
36 #include "epan/expert.h"
37 #include <epan/asn1.h>
42 #include "packet-ber.h"
43 #include "packet-inap.h"
44 #include "packet-q931.h"
45 #include "packet-e164.h"
46 #include "packet-isup.h"
47 #include "packet-tcap.h"
49 #define PNAME "Intelligent Network Application Protocol"
53 /* Initialize the protocol and registered fields */
56 /* include constants */
57 #include "packet-inap-val.h"
59 #include "packet-inap-hf.c"
62 static range_t *global_ssn_range;
64 static dissector_handle_t inap_handle;
66 /* Global variables */
67 static guint32 opcode=0;
68 static guint32 errorCode=0;
70 static int inap_opcode_type;
71 #define INAP_OPCODE_INVOKE 1
72 #define INAP_OPCODE_RETURN_RESULT 2
73 #define INAP_OPCODE_RETURN_ERROR 3
74 #define INAP_OPCODE_REJECT 4
76 /* Initialize the subtree pointers */
77 static gint ett_inap = -1;
78 static gint ett_inapisup_parameter = -1;
79 #include "packet-inap-ett.c"
81 #include "packet-inap-table.c"
83 const value_string inap_general_problem_strings[] = {
84 {0,"General Problem Unrecognized Component"},
85 {1,"General Problem Mistyped Component"},
86 {3,"General Problem Badly Structured Component"},
90 /* Forvard declarations */
91 static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
92 static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
93 static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx);
95 #include "packet-inap-fn.c"
97 TC-Invokable OPERATION ::=
98 {activateServiceFiltering | activityTest | analysedInformation |
99 analyseInformation | applyCharging | applyChargingReport |
100 assistRequestInstructions | callGap | callInformationReport |
101 callInformationRequest | cancel | cancelStatusReportRequest |
102 collectedInformation | collectInformation | connect | connectToResource |
103 continue | disconnectForwardConnection | establishTemporaryConnection |
104 eventNotificationCharging | eventReportBCSM | furnishChargingInformation |
105 holdCallInNetwork | initialDP | initiateCallAttempt | oAnswer |
106 oCalledPartyBusy | oDisconnect | oMidCall | oNoAnswer |
107 originationAttemptAuthorized | releaseCall | requestCurrentStatusReport |
108 requestEveryStatusChangeReport | requestFirstStatusMatchReport |
109 requestNotificationChargingEvent | requestReportBCSMEvent | resetTimer |
110 routeSelectFailure | selectFacility | selectRoute | sendChargingInformation
111 | serviceFilteringResponse | statusReport | tAnswer | tBusy | tDisconnect |
112 termAttemptAuthorized | tMidCall | tNoAnswer | playAnnouncement |
113 promptAndCollectUserInformation}
116 #include "packet-inap-table2.c"
119 static guint8 inap_pdu_type = 0;
120 static guint8 inap_pdu_size = 0;
124 dissect_inap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
126 proto_item *item=NULL;
127 proto_tree *tree=NULL;
130 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
132 if (check_col(pinfo->cinfo, COL_PROTOCOL))
134 col_set_str(pinfo->cinfo, COL_PROTOCOL, "INAP");
137 /* create display subtree for the protocol */
139 item = proto_tree_add_item(parent_tree, proto_inap, tvb, 0, -1, FALSE);
140 tree = proto_item_add_subtree(item, ett_inap);
142 inap_pdu_type = tvb_get_guint8(tvb, offset)&0x0f;
143 /* Get the length and add 2 */
144 inap_pdu_size = tvb_get_guint8(tvb, offset+1)+2;
146 offset = dissect_inap_ROS(TRUE, tvb, offset, &asn1_ctx, tree, -1);
151 /*--- proto_reg_handoff_inap ---------------------------------------*/
152 static void range_delete_callback(guint32 ssn)
155 delete_itu_tcap_subdissector(ssn, inap_handle);
159 static void range_add_callback(guint32 ssn)
162 add_itu_tcap_subdissector(ssn, inap_handle);
166 void proto_reg_handoff_inap(void) {
168 static gboolean inap_prefs_initialized = FALSE;
169 static range_t *ssn_range;
171 if (!inap_prefs_initialized) {
172 inap_prefs_initialized = TRUE;
173 inap_handle = find_dissector("inap");
174 oid_add_from_string("Core-INAP-CS1-Codes","0.4.0.1.1.0.3.0");
177 range_foreach(ssn_range, range_delete_callback);
181 ssn_range = range_copy(global_ssn_range);
183 range_foreach(ssn_range, range_add_callback);
188 void proto_register_inap(void) {
189 module_t *inap_module;
191 static hf_register_info hf[] = {
195 #include "packet-inap-hfarr.c"
203 /* List of subtrees */
204 static gint *ett[] = {
206 &ett_inapisup_parameter,
207 #include "packet-inap-ettarr.c"
210 /* Register protocol */
211 proto_inap = proto_register_protocol(PNAME, PSNAME, PFNAME);
212 register_dissector("inap", dissect_inap, proto_inap);
213 /* Register fields and subtrees */
214 proto_register_field_array(proto_inap, hf, array_length(hf));
215 proto_register_subtree_array(ett, array_length(ett));
217 /* Set default SSNs */
218 range_convert_str(&global_ssn_range, "106,241", MAX_SSN);
220 inap_module = prefs_register_protocol(proto_inap, proto_reg_handoff_inap);
222 prefs_register_obsolete_preference(inap_module, "tcap.itu_ssn");
224 prefs_register_obsolete_preference(inap_module, "tcap.itu_ssn1");
226 prefs_register_range_preference(inap_module, "ssn", "TCAP SSNs",
227 "TCAP Subsystem numbers used for INAP",
228 &global_ssn_range, MAX_SSN);