The data contained in this repository can be downloaded to your computer using one of several clients.
Please see the documentation of your version control software client for more information.
Please select the desired protocol below to get the URL.
This URL has Read-Only access.
main_repo / asn1 / inap / packet-inap-template.c @ master
History | View | Annotate | Download (7.89 KB)
1 | ed95a580 | ndrulard2011 | /* 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>
|
||
5 | *
|
||
6 | * $Id$
|
||
7 | * Wireshark - Network traffic analyzer
|
||
8 | * By Gerald Combs <gerald@wireshark.org>
|
||
9 | * Copyright 1998 Gerald Combs
|
||
10 | *
|
||
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.
|
||
15 | *
|
||
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.
|
||
20 | *
|
||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||
24 | * References: ETSI 300 374
|
||
25 | * ITU Q.1218
|
||
26 | */
|
||
27 | |||
28 | #include "config.h" |
||
29 | |||
30 | #include <glib.h> |
||
31 | #include <epan/packet.h> |
||
32 | #include <epan/prefs.h> |
||
33 | #include <epan/oids.h> |
||
34 | #include <epan/expert.h> |
||
35 | #include <epan/asn1.h> |
||
36 | |||
37 | #include "packet-ber.h" |
||
38 | #include "packet-inap.h" |
||
39 | #include "packet-q931.h" |
||
40 | #include "packet-e164.h" |
||
41 | #include "packet-isup.h" |
||
42 | #include "packet-tcap.h" |
||
43 | #include "packet-dap.h" |
||
44 | #include "packet-dsp.h" |
||
45 | |||
46 | #define PNAME "Intelligent Network Application Protocol" |
||
47 | #define PSNAME "INAP" |
||
48 | #define PFNAME "inap" |
||
49 | |||
50 | void proto_register_inap(void); |
||
51 | void proto_reg_handoff_inap(void); |
||
52 | |||
53 | |||
54 | /* Initialize the protocol and registered fields */
|
||
55 | static int proto_inap = -1; |
||
56 | |||
57 | /* include constants */
|
||
58 | #include "packet-inap-val.h" |
||
59 | |||
60 | #include "packet-inap-hf.c" |
||
61 | |||
62 | #define MAX_SSN 254 |
||
63 | static range_t *global_ssn_range;
|
||
64 | |||
65 | static dissector_handle_t inap_handle;
|
||
66 | static dissector_handle_t data_handle;
|
||
67 | |||
68 | /* Global variables */
|
||
69 | static guint32 opcode=0; |
||
70 | static guint32 errorCode=0; |
||
71 | static const char *obj_id = NULL; |
||
72 | |||
73 | static int inap_opcode_type; |
||
74 | #define INAP_OPCODE_INVOKE 1 |
||
75 | #define INAP_OPCODE_RETURN_RESULT 2 |
||
76 | #define INAP_OPCODE_RETURN_ERROR 3 |
||
77 | #define INAP_OPCODE_REJECT 4 |
||
78 | |||
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 | #include "packet-inap-ett.c" |
||
84 | |||
85 | static expert_field ei_inap_unknown_invokeData = EI_INIT;
|
||
86 | static expert_field ei_inap_unknown_returnResultData = EI_INIT;
|
||
87 | static expert_field ei_inap_unknown_returnErrorData = EI_INIT;
|
||
88 | |||
89 | #include "packet-inap-table.c" |
||
90 | |||
91 | const value_string inap_general_problem_strings[] = {
|
||
92 | {0,"General Problem Unrecognized Component"}, |
||
93 | {1,"General Problem Mistyped Component"}, |
||
94 | {3,"General Problem Badly Structured Component"}, |
||
95 | {0, NULL} |
||
96 | }; |
||
97 | |||
98 | /* Forvard declarations */
|
||
99 | static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_); |
||
100 | static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_); |
||
101 | static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx); |
||
102 | |||
103 | #include "packet-inap-fn.c" |
||
104 | /*
|
||
105 | TC-Invokable OPERATION ::=
|
||
106 | {activateServiceFiltering | activityTest | analysedInformation |
|
||
107 | analyseInformation | applyCharging | applyChargingReport |
|
||
108 | assistRequestInstructions | callGap | callInformationReport |
|
||
109 | callInformationRequest | cancel | cancelStatusReportRequest |
|
||
110 | collectedInformation | collectInformation | connect | connectToResource |
|
||
111 | continue | disconnectForwardConnection | establishTemporaryConnection |
|
||
112 | eventNotificationCharging | eventReportBCSM | furnishChargingInformation |
|
||
113 | holdCallInNetwork | initialDP | initiateCallAttempt | oAnswer |
|
||
114 | oCalledPartyBusy | oDisconnect | oMidCall | oNoAnswer |
|
||
115 | originationAttemptAuthorized | releaseCall | requestCurrentStatusReport |
|
||
116 | requestEveryStatusChangeReport | requestFirstStatusMatchReport |
|
||
117 | requestNotificationChargingEvent | requestReportBCSMEvent | resetTimer |
|
||
118 | routeSelectFailure | selectFacility | selectRoute | sendChargingInformation
|
||
119 | | serviceFilteringResponse | statusReport | tAnswer | tBusy | tDisconnect |
|
||
120 | termAttemptAuthorized | tMidCall | tNoAnswer | playAnnouncement |
|
||
121 | promptAndCollectUserInformation}
|
||
122 | */
|
||
123 | |||
124 | #include "packet-inap-table2.c" |
||
125 | |||
126 | |||
127 | static guint8 inap_pdu_type = 0; |
||
128 | static guint8 inap_pdu_size = 0; |
||
129 | |||
130 | |||
131 | static void |
||
132 | dissect_inap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) |
||
133 | { |
||
134 | proto_item *item=NULL;
|
||
135 | proto_tree *tree=NULL;
|
||
136 | int offset = 0; |
||
137 | asn1_ctx_t asn1_ctx; |
||
138 | asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); |
||
139 | |||
140 | col_set_str(pinfo->cinfo, COL_PROTOCOL, "INAP");
|
||
141 | |||
142 | /* create display subtree for the protocol */
|
||
143 | if(parent_tree){
|
||
144 | item = proto_tree_add_item(parent_tree, proto_inap, tvb, 0, -1, ENC_NA); |
||
145 | tree = proto_item_add_subtree(item, ett_inap); |
||
146 | } |
||
147 | inap_pdu_type = tvb_get_guint8(tvb, offset)&0x0f;
|
||
148 | /* Get the length and add 2 */
|
||
149 | inap_pdu_size = tvb_get_guint8(tvb, offset+1)+2; |
||
150 | opcode = 0;
|
||
151 | dissect_inap_ROS(TRUE, tvb, offset, &asn1_ctx, tree, -1);
|
||
152 | |||
153 | |||
154 | } |
||
155 | |||
156 | /*--- proto_reg_handoff_inap ---------------------------------------*/
|
||
157 | static void range_delete_callback(guint32 ssn) |
||
158 | { |
||
159 | if (ssn) {
|
||
160 | delete_itu_tcap_subdissector(ssn, inap_handle); |
||
161 | } |
||
162 | } |
||
163 | |||
164 | static void range_add_callback(guint32 ssn) |
||
165 | { |
||
166 | if (ssn) {
|
||
167 | add_itu_tcap_subdissector(ssn, inap_handle); |
||
168 | } |
||
169 | } |
||
170 | |||
171 | void proto_reg_handoff_inap(void) { |
||
172 | |||
173 | static gboolean inap_prefs_initialized = FALSE;
|
||
174 | static range_t *ssn_range;
|
||
175 | |||
176 | if (!inap_prefs_initialized) {
|
||
177 | inap_prefs_initialized = TRUE; |
||
178 | inap_handle = find_dissector("inap");
|
||
179 | data_handle = find_dissector("data");
|
||
180 | oid_add_from_string("Core-INAP-CS1-Codes","0.4.0.1.1.0.3.0"); |
||
181 | 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"); |
||
182 | oid_add_from_string("alcatel(1006)","1.3.12.2.1006.64"); |
||
183 | oid_add_from_string("Siemens (1107)","1.3.12.2.1107"); |
||
184 | 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"); |
||
185 | } |
||
186 | else {
|
||
187 | range_foreach(ssn_range, range_delete_callback); |
||
188 | g_free(ssn_range); |
||
189 | } |
||
190 | |||
191 | ssn_range = range_copy(global_ssn_range); |
||
192 | |||
193 | range_foreach(ssn_range, range_add_callback); |
||
194 | |||
195 | } |
||
196 | |||
197 | |||
198 | void proto_register_inap(void) { |
||
199 | module_t *inap_module; |
||
200 | /* List of fields */
|
||
201 | static hf_register_info hf[] = {
|
||
202 | |||
203 | |||
204 | |||
205 | #include "packet-inap-hfarr.c" |
||
206 | }; |
||
207 | |||
208 | |||
209 | |||
210 | |||
211 | |||
212 | |||
213 | /* List of subtrees */
|
||
214 | static gint *ett[] = {
|
||
215 | &ett_inap, |
||
216 | &ett_inapisup_parameter, |
||
217 | &ett_inap_HighLayerCompatibility, |
||
218 | #include "packet-inap-ettarr.c" |
||
219 | }; |
||
220 | |||
221 | static ei_register_info ei[] = {
|
||
222 | { &ei_inap_unknown_invokeData, { "inap.unknown.invokeData", PI_MALFORMED, PI_WARN, "Unknown invokeData", EXPFILL }}, |
||
223 | { &ei_inap_unknown_returnResultData, { "inap.unknown.returnResultData", PI_MALFORMED, PI_WARN, "Unknown returnResultData", EXPFILL }}, |
||
224 | { &ei_inap_unknown_returnErrorData, { "inap.unknown.returnErrorData", PI_MALFORMED, PI_WARN, "Unknown returnResultData", EXPFILL }}, |
||
225 | }; |
||
226 | |||
227 | expert_module_t* expert_inap; |
||
228 | |||
229 | /* Register protocol */
|
||
230 | proto_inap = proto_register_protocol(PNAME, PSNAME, PFNAME); |
||
231 | register_dissector("inap", dissect_inap, proto_inap);
|
||
232 | /* Register fields and subtrees */
|
||
233 | proto_register_field_array(proto_inap, hf, array_length(hf)); |
||
234 | proto_register_subtree_array(ett, array_length(ett)); |
||
235 | expert_inap = expert_register_protocol(proto_inap); |
||
236 | expert_register_field_array(expert_inap, ei, array_length(ei)); |
||
237 | |||
238 | /* Set default SSNs */
|
||
239 | range_convert_str(&global_ssn_range, "106,241", MAX_SSN);
|
||
240 | |||
241 | inap_module = prefs_register_protocol(proto_inap, proto_reg_handoff_inap); |
||
242 | |||
243 | prefs_register_obsolete_preference(inap_module, "tcap.itu_ssn");
|
||
244 | |||
245 | prefs_register_obsolete_preference(inap_module, "tcap.itu_ssn1");
|
||
246 | |||
247 | prefs_register_range_preference(inap_module, "ssn", "TCAP SSNs", |
||
248 | "TCAP Subsystem numbers used for INAP",
|
||
249 | &global_ssn_range, MAX_SSN); |
||
250 | } |
||
251 | |||
252 |