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>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 * References: ETSI 300 374
29 #include <epan/packet.h>
30 #include <epan/prefs.h>
31 #include <epan/oids.h>
32 #include <epan/expert.h>
33 #include <epan/asn1.h>
35 #include "packet-ber.h"
36 #include "packet-inap.h"
37 #include "packet-q931.h"
38 #include "packet-e164.h"
39 #include "packet-isup.h"
40 #include "packet-tcap.h"
41 #include "packet-dap.h"
42 #include "packet-dsp.h"
44 #define PNAME "Intelligent Network Application Protocol"
48 void proto_register_inap(void);
49 void proto_reg_handoff_inap(void);
52 /* Initialize the protocol and registered fields */
53 static int proto_inap = -1;
55 /* include constants */
56 #include "packet-inap-val.h"
58 #include "packet-inap-hf.c"
61 static range_t *global_ssn_range;
63 static dissector_handle_t inap_handle;
64 static dissector_handle_t data_handle;
66 /* Global variables */
67 static guint32 opcode=0;
68 static guint32 errorCode=0;
69 static const char *obj_id = NULL;
71 static int inap_opcode_type;
72 #define INAP_OPCODE_INVOKE 1
73 #define INAP_OPCODE_RETURN_RESULT 2
74 #define INAP_OPCODE_RETURN_ERROR 3
75 #define INAP_OPCODE_REJECT 4
77 static int hf_inap_cause_indicator = -1;
79 /* Initialize the subtree pointers */
80 static gint ett_inap = -1;
81 static gint ett_inapisup_parameter = -1;
82 static gint ett_inap_HighLayerCompatibility = -1;
83 static gint ett_inap_extension_data = -1;
84 static gint ett_inap_cause = -1;
86 #include "packet-inap-ett.c"
88 static expert_field ei_inap_unknown_invokeData = EI_INIT;
89 static expert_field ei_inap_unknown_returnResultData = EI_INIT;
90 static expert_field ei_inap_unknown_returnErrorData = EI_INIT;
92 #include "packet-inap-table.c"
94 const value_string inap_general_problem_strings[] = {
95 {0,"General Problem Unrecognized Component"},
96 {1,"General Problem Mistyped Component"},
97 {3,"General Problem Badly Structured Component"},
101 /* Forvard declarations */
102 static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
103 static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
104 static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx);
106 #include "packet-inap-fn.c"
108 TC-Invokable OPERATION ::=
109 {activateServiceFiltering | activityTest | analysedInformation |
110 analyseInformation | applyCharging | applyChargingReport |
111 assistRequestInstructions | callGap | callInformationReport |
112 callInformationRequest | cancel | cancelStatusReportRequest |
113 collectedInformation | collectInformation | connect | connectToResource |
114 continue | disconnectForwardConnection | establishTemporaryConnection |
115 eventNotificationCharging | eventReportBCSM | furnishChargingInformation |
116 holdCallInNetwork | initialDP | initiateCallAttempt | oAnswer |
117 oCalledPartyBusy | oDisconnect | oMidCall | oNoAnswer |
118 originationAttemptAuthorized | releaseCall | requestCurrentStatusReport |
119 requestEveryStatusChangeReport | requestFirstStatusMatchReport |
120 requestNotificationChargingEvent | requestReportBCSMEvent | resetTimer |
121 routeSelectFailure | selectFacility | selectRoute | sendChargingInformation
122 | serviceFilteringResponse | statusReport | tAnswer | tBusy | tDisconnect |
123 termAttemptAuthorized | tMidCall | tNoAnswer | playAnnouncement |
124 promptAndCollectUserInformation}
127 #include "packet-inap-table2.c"
130 static guint8 inap_pdu_type = 0;
131 static guint8 inap_pdu_size = 0;
135 dissect_inap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data _U_)
137 proto_item *item=NULL;
138 proto_tree *tree=NULL;
141 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
143 col_set_str(pinfo->cinfo, COL_PROTOCOL, "INAP");
145 /* create display subtree for the protocol */
147 item = proto_tree_add_item(parent_tree, proto_inap, tvb, 0, -1, ENC_NA);
148 tree = proto_item_add_subtree(item, ett_inap);
150 inap_pdu_type = tvb_get_guint8(tvb, offset)&0x0f;
151 /* Get the length and add 2 */
152 inap_pdu_size = tvb_get_guint8(tvb, offset+1)+2;
154 dissect_inap_ROS(TRUE, tvb, offset, &asn1_ctx, tree, -1);
156 return inap_pdu_size;
159 /*--- proto_reg_handoff_inap ---------------------------------------*/
160 static void range_delete_callback(guint32 ssn)
163 delete_itu_tcap_subdissector(ssn, inap_handle);
167 static void range_add_callback(guint32 ssn)
170 add_itu_tcap_subdissector(ssn, inap_handle);
174 void proto_reg_handoff_inap(void) {
176 static gboolean inap_prefs_initialized = FALSE;
177 static range_t *ssn_range;
179 if (!inap_prefs_initialized) {
180 inap_prefs_initialized = TRUE;
181 inap_handle = find_dissector("inap");
182 data_handle = find_dissector("data");
183 oid_add_from_string("Core-INAP-CS1-Codes","0.4.0.1.1.0.3.0");
184 oid_add_from_string("iso(1) identified-organization(3) icd-ecma(12) member-company(2) 1107 oen(3) inap(3) extensions(2)","1.3.12.2.1107.3.3.2");
185 oid_add_from_string("alcatel(1006)","1.3.12.2.1006.64");
186 oid_add_from_string("Siemens (1107)","1.3.12.2.1107");
187 oid_add_from_string("iso(1) member-body(2) gb(826) national(0) ericsson(1249) inDomain(51) inNetwork(1) inNetworkcapabilitySet1plus(1) ","1.2.826.0.1249.51.1.1");
190 range_foreach(ssn_range, range_delete_callback);
194 ssn_range = range_copy(global_ssn_range);
196 range_foreach(ssn_range, range_add_callback);
201 void proto_register_inap(void) {
202 module_t *inap_module;
204 static hf_register_info hf[] = {
207 { &hf_inap_cause_indicator, /* Currently not enabled */
208 { "Cause indicator", "inap.cause_indicator",
209 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &q850_cause_code_vals_ext, 0x7f,
212 #include "packet-inap-hfarr.c"
220 /* List of subtrees */
221 static gint *ett[] = {
223 &ett_inapisup_parameter,
224 &ett_inap_HighLayerCompatibility,
225 &ett_inap_extension_data,
227 #include "packet-inap-ettarr.c"
230 static ei_register_info ei[] = {
231 { &ei_inap_unknown_invokeData, { "inap.unknown.invokeData", PI_MALFORMED, PI_WARN, "Unknown invokeData", EXPFILL }},
232 { &ei_inap_unknown_returnResultData, { "inap.unknown.returnResultData", PI_MALFORMED, PI_WARN, "Unknown returnResultData", EXPFILL }},
233 { &ei_inap_unknown_returnErrorData, { "inap.unknown.returnErrorData", PI_MALFORMED, PI_WARN, "Unknown returnResultData", EXPFILL }},
236 expert_module_t* expert_inap;
238 /* Register protocol */
239 proto_inap = proto_register_protocol(PNAME, PSNAME, PFNAME);
240 register_dissector("inap", dissect_inap, proto_inap);
241 /* Register fields and subtrees */
242 proto_register_field_array(proto_inap, hf, array_length(hf));
243 proto_register_subtree_array(ett, array_length(ett));
244 expert_inap = expert_register_protocol(proto_inap);
245 expert_register_field_array(expert_inap, ei, array_length(ei));
247 register_ber_oid_dissector("0.4.0.1.1.1.0.0", dissect_inap, proto_inap, "cs1-ssp-to-scp");
249 /* Set default SSNs */
250 range_convert_str(&global_ssn_range, "106,241", MAX_SSN);
252 inap_module = prefs_register_protocol(proto_inap, proto_reg_handoff_inap);
254 prefs_register_obsolete_preference(inap_module, "tcap.itu_ssn");
256 prefs_register_obsolete_preference(inap_module, "tcap.itu_ssn1");
258 prefs_register_range_preference(inap_module, "ssn", "TCAP SSNs",
259 "TCAP Subsystem numbers used for INAP",
260 &global_ssn_range, MAX_SSN);
269 * indent-tabs-mode: nil
272 * ex: set shiftwidth=2 tabstop=8 expandtab:
273 * :indentSize=2:tabSize=8:noTabs=true: