TODO netlogon_user_flags_ntlmv2_enabled
[wireshark-sm.git] / epan / dissectors / asn1 / inap / packet-inap-template.c
blob761e04be814db08144e5009c6666ebd5ed3e6f24
1 /* packet-inap-template.c
2 * Routines for INAP
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 * SPDX-License-Identifier: GPL-2.0-or-later
11 * References: ETSI 300 374
12 * ITU Q.1218
15 #include "config.h"
17 #include <epan/packet.h>
18 #include <epan/prefs.h>
19 #include <epan/oids.h>
20 #include <epan/expert.h>
21 #include <epan/asn1.h>
22 #include <wsutil/array.h>
24 #include "packet-ber.h"
25 #include "packet-inap.h"
26 #include "packet-q931.h"
27 #include "packet-e164.h"
28 #include "packet-isup.h"
29 #include "packet-tcap.h"
30 #include "packet-dap.h"
31 #include "packet-dsp.h"
33 #define PNAME "Intelligent Network Application Protocol"
34 #define PSNAME "INAP"
35 #define PFNAME "inap"
37 void proto_register_inap(void);
38 void proto_reg_handoff_inap(void);
41 /* Initialize the protocol and registered fields */
42 static int proto_inap;
44 /* include constants */
45 #include "packet-inap-val.h"
47 #include "packet-inap-hf.c"
49 #define MAX_SSN 254
50 static range_t *global_ssn_range;
52 static dissector_handle_t inap_handle;
54 /* Global variables */
55 static uint32_t opcode=0;
56 static uint32_t errorCode=0;
57 static const char *obj_id;
58 static bool is_ExtensionField;
60 static int inap_opcode_type;
61 #define INAP_OPCODE_INVOKE 1
62 #define INAP_OPCODE_RETURN_RESULT 2
63 #define INAP_OPCODE_RETURN_ERROR 3
64 #define INAP_OPCODE_REJECT 4
66 static int hf_inap_cause_indicator;
68 /* Initialize the subtree pointers */
69 static int ett_inap;
70 static int ett_inapisup_parameter;
71 static int ett_inap_RedirectionInformation;
72 static int ett_inap_HighLayerCompatibility;
73 static int ett_inap_extension_data;
74 static int ett_inap_cause;
75 static int ett_inap_calledAddressValue;
76 static int ett_inap_callingAddressValue;
77 static int ett_inap_additionalCallingPartyNumber;
78 static int ett_inap_assistingSSPIPRoutingAddress;
79 static int ett_inap_correlationID;
80 static int ett_inap_number;
81 static int ett_inap_dialledNumber;
82 static int ett_inap_callingLineID;
83 static int ett_inap_iNServiceControlCode;
84 static int ett_inap_iNServiceControlCodeLow;
85 static int ett_inap_iNServiceControlCodeHigh;
86 static int ett_inap_lineID;
87 static int ett_inap_prefix;
88 static int ett_inap_iPAddressValue;
89 static int ett_inap_digitsResponse;
91 #include "packet-inap-ett.c"
93 static expert_field ei_inap_unknown_invokeData;
94 static expert_field ei_inap_unknown_returnResultData;
95 static expert_field ei_inap_unknown_returnErrorData;
97 #include "packet-inap-table.c"
99 #if 0
100 static const value_string inap_general_problem_strings[] = {
101 {0,"General Problem Unrecognized Component"},
102 {1,"General Problem Mistyped Component"},
103 {3,"General Problem Badly Structured Component"},
104 {0, NULL}
106 #endif
108 /* Forward declarations */
109 static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
110 static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
111 static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx);
113 #include "packet-inap-fn.c"
115 TC-Invokable OPERATION ::=
116 {activateServiceFiltering | activityTest | analysedInformation |
117 analyseInformation | applyCharging | applyChargingReport |
118 assistRequestInstructions | callGap | callInformationReport |
119 callInformationRequest | cancel | cancelStatusReportRequest |
120 collectedInformation | collectInformation | connect | connectToResource |
121 continue | disconnectForwardConnection | establishTemporaryConnection |
122 eventNotificationCharging | eventReportBCSM | furnishChargingInformation |
123 holdCallInNetwork | initialDP | initiateCallAttempt | oAnswer |
124 oCalledPartyBusy | oDisconnect | oMidCall | oNoAnswer |
125 originationAttemptAuthorized | releaseCall | requestCurrentStatusReport |
126 requestEveryStatusChangeReport | requestFirstStatusMatchReport |
127 requestNotificationChargingEvent | requestReportBCSMEvent | resetTimer |
128 routeSelectFailure | selectFacility | selectRoute | sendChargingInformation
129 | serviceFilteringResponse | statusReport | tAnswer | tBusy | tDisconnect |
130 termAttemptAuthorized | tMidCall | tNoAnswer | playAnnouncement |
131 promptAndCollectUserInformation}
134 #include "packet-inap-table2.c"
137 static uint8_t inap_pdu_type;
138 static uint8_t inap_pdu_size;
141 static int
142 dissect_inap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data _U_)
144 proto_item *item=NULL;
145 proto_tree *tree=NULL;
146 int offset = 0;
147 asn1_ctx_t asn1_ctx;
148 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
150 col_set_str(pinfo->cinfo, COL_PROTOCOL, "INAP");
152 /* create display subtree for the protocol */
153 if(parent_tree){
154 item = proto_tree_add_item(parent_tree, proto_inap, tvb, 0, -1, ENC_NA);
155 tree = proto_item_add_subtree(item, ett_inap);
157 inap_pdu_type = tvb_get_uint8(tvb, offset)&0x0f;
158 /* Get the length and add 2 */
159 inap_pdu_size = tvb_get_uint8(tvb, offset+1)+2;
160 opcode = 0;
161 is_ExtensionField =false;
162 dissect_inap_ROS(true, tvb, offset, &asn1_ctx, tree, -1);
164 return inap_pdu_size;
167 /*--- proto_reg_handoff_inap ---------------------------------------*/
168 static void range_delete_callback(uint32_t ssn, void *ptr _U_)
170 if (ssn) {
171 delete_itu_tcap_subdissector(ssn, inap_handle);
175 static void range_add_callback(uint32_t ssn, void *ptr _U_)
177 if (ssn) {
178 add_itu_tcap_subdissector(ssn, inap_handle);
182 void proto_reg_handoff_inap(void) {
184 static bool inap_prefs_initialized = false;
185 static range_t *ssn_range;
187 if (!inap_prefs_initialized) {
188 inap_prefs_initialized = true;
189 oid_add_from_string("Core-INAP-CS1-Codes","0.4.0.1.1.0.3.0");
190 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");
191 oid_add_from_string("alcatel(1006)","1.3.12.2.1006.64");
192 oid_add_from_string("Siemens (1107)","1.3.12.2.1107");
193 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");
195 else {
196 range_foreach(ssn_range, range_delete_callback, NULL);
197 wmem_free(wmem_epan_scope(), ssn_range);
200 ssn_range = range_copy(wmem_epan_scope(), global_ssn_range);
202 range_foreach(ssn_range, range_add_callback, NULL);
207 void proto_register_inap(void) {
208 module_t *inap_module;
209 /* List of fields */
210 static hf_register_info hf[] = {
213 { &hf_inap_cause_indicator, /* Currently not enabled */
214 { "Cause indicator", "inap.cause_indicator",
215 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &q850_cause_code_vals_ext, 0x7f,
216 NULL, HFILL } },
218 #include "packet-inap-hfarr.c"
226 /* List of subtrees */
227 static int *ett[] = {
228 &ett_inap,
229 &ett_inapisup_parameter,
230 &ett_inap_RedirectionInformation,
231 &ett_inap_HighLayerCompatibility,
232 &ett_inap_extension_data,
233 &ett_inap_cause,
234 &ett_inap_calledAddressValue,
235 &ett_inap_callingAddressValue,
236 &ett_inap_additionalCallingPartyNumber,
237 &ett_inap_assistingSSPIPRoutingAddress,
238 &ett_inap_correlationID,
239 &ett_inap_number,
240 &ett_inap_dialledNumber,
241 &ett_inap_callingLineID,
242 &ett_inap_iNServiceControlCode,
243 &ett_inap_iNServiceControlCodeLow,
244 &ett_inap_iNServiceControlCodeHigh,
245 &ett_inap_lineID,
246 &ett_inap_prefix,
247 &ett_inap_iPAddressValue,
248 &ett_inap_digitsResponse,
249 #include "packet-inap-ettarr.c"
252 static ei_register_info ei[] = {
253 { &ei_inap_unknown_invokeData, { "inap.unknown.invokeData", PI_MALFORMED, PI_WARN, "Unknown invokeData", EXPFILL }},
254 { &ei_inap_unknown_returnResultData, { "inap.unknown.returnResultData", PI_MALFORMED, PI_WARN, "Unknown returnResultData", EXPFILL }},
255 { &ei_inap_unknown_returnErrorData, { "inap.unknown.returnErrorData", PI_MALFORMED, PI_WARN, "Unknown returnErrorData", EXPFILL }},
258 expert_module_t* expert_inap;
260 /* Register protocol */
261 proto_inap = proto_register_protocol(PNAME, PSNAME, PFNAME);
262 inap_handle = register_dissector("inap", dissect_inap, proto_inap);
263 /* Register fields and subtrees */
264 proto_register_field_array(proto_inap, hf, array_length(hf));
265 proto_register_subtree_array(ett, array_length(ett));
266 expert_inap = expert_register_protocol(proto_inap);
267 expert_register_field_array(expert_inap, ei, array_length(ei));
269 register_ber_oid_dissector("0.4.0.1.1.1.0.0", dissect_inap, proto_inap, "cs1-ssp-to-scp");
271 /* Set default SSNs */
272 range_convert_str(wmem_epan_scope(), &global_ssn_range, "106,241", MAX_SSN);
274 inap_module = prefs_register_protocol(proto_inap, proto_reg_handoff_inap);
276 prefs_register_obsolete_preference(inap_module, "tcap.itu_ssn");
278 prefs_register_obsolete_preference(inap_module, "tcap.itu_ssn1");
280 prefs_register_range_preference(inap_module, "ssn", "TCAP SSNs",
281 "TCAP Subsystem numbers used for INAP",
282 &global_ssn_range, MAX_SSN);
286 * Editor modelines
288 * Local Variables:
289 * c-basic-offset: 2
290 * tab-width: 8
291 * indent-tabs-mode: nil
292 * End:
294 * ex: set shiftwidth=2 tabstop=8 expandtab:
295 * :indentSize=2:tabSize=8:noTabs=true: