/src/wireshark/epan/dissectors/packet-q932.c
Line | Count | Source |
1 | | /* Do not modify this file. Changes will be overwritten. */ |
2 | | /* Generated automatically by the ASN.1 to Wireshark dissector compiler */ |
3 | | /* packet-q932.c */ |
4 | | /* asn2wrs.py -b -q -L -p q932 -c ./q932.cnf -s ./packet-q932-template -D . -O ../.. Addressing-Data-Elements.asn Network-Facility-Extension.asn Network-Protocol-Profile-component.asn Interpretation-component.asn */ |
5 | | |
6 | | /* packet-q932.c |
7 | | * Routines for Q.932 packet dissection |
8 | | * 2007 Tomas Kukosa |
9 | | * |
10 | | * Wireshark - Network traffic analyzer |
11 | | * By Gerald Combs <gerald@wireshark.org> |
12 | | * Copyright 1998 Gerald Combs |
13 | | * |
14 | | * SPDX-License-Identifier: GPL-2.0-or-later |
15 | | */ |
16 | | |
17 | | #include "config.h" |
18 | | |
19 | | #include <epan/packet.h> |
20 | | #include <epan/expert.h> |
21 | | #include <epan/strutil.h> |
22 | | #include <epan/asn1.h> |
23 | | #include <epan/prefs.h> |
24 | | #include <wsutil/array.h> |
25 | | |
26 | | #include "packet-ber.h" |
27 | | #include "packet-q932.h" |
28 | | |
29 | 14 | #define PNAME "Q.932" |
30 | 14 | #define PSNAME "Q932" |
31 | 14 | #define PFNAME "q932" |
32 | | |
33 | | void proto_register_q932(void); |
34 | | |
35 | | /* Initialize the protocol and registered fields */ |
36 | | static int proto_q932; |
37 | | static int hf_q932_ie_type; |
38 | | static int hf_q932_ie_len; |
39 | | static int hf_q932_ie_data; |
40 | | static int hf_q932_pp; |
41 | | static int hf_q932_nd; |
42 | | static int hf_q932_NetworkFacilityExtension_PDU; /* NetworkFacilityExtension */ |
43 | | static int hf_q932_NetworkProtocolProfile_PDU; /* NetworkProtocolProfile */ |
44 | | static int hf_q932_InterpretationComponent_PDU; /* InterpretationComponent */ |
45 | | static int hf_q932_presentationAlIowedAddress; /* AddressScreened */ |
46 | | static int hf_q932_presentationRestricted; /* NULL */ |
47 | | static int hf_q932_numberNotAvailableDueTolnterworking; /* NULL */ |
48 | | static int hf_q932_presentationRestrictedAddressScreened; /* AddressScreened */ |
49 | | static int hf_q932_presentationAllowedAddress; /* Address */ |
50 | | static int hf_q932_presentationRestrictedAddress; /* Address */ |
51 | | static int hf_q932_presentationAllowedNumberScreened; /* NumberScreened */ |
52 | | static int hf_q932_numberNotAvailableDueToInterworking; /* NULL */ |
53 | | static int hf_q932_presentationRestrictedNumberScreened; /* NumberScreened */ |
54 | | static int hf_q932_presentationAllowedNumber; /* PartyNumber */ |
55 | | static int hf_q932_presentationRestrictedNumber; /* PartyNumber */ |
56 | | static int hf_q932_partyNumber; /* PartyNumber */ |
57 | | static int hf_q932_screeninglndicator; /* ScreeningIndicator */ |
58 | | static int hf_q932_partySubaddress; /* PartySubaddress */ |
59 | | static int hf_q932_screeningIndicator; /* ScreeningIndicator */ |
60 | | static int hf_q932_unknownPartyNumber; /* NumberDigits */ |
61 | | static int hf_q932_publicPartyNumber; /* PublicPartyNumber */ |
62 | | static int hf_q932_nsapEncodedNumber; /* NsapEncodedNumber */ |
63 | | static int hf_q932_dataPartyNumber; /* NumberDigits */ |
64 | | static int hf_q932_telexPartyNumber; /* NumberDigits */ |
65 | | static int hf_q932_privatePartyNumber; /* PrivatePartyNumber */ |
66 | | static int hf_q932_nationalStandardPartyNumber; /* NumberDigits */ |
67 | | static int hf_q932_publicTypeOfNumber; /* PublicTypeOfNumber */ |
68 | | static int hf_q932_publicNumberDigits; /* NumberDigits */ |
69 | | static int hf_q932_privateTypeOfNumber; /* PrivateTypeOfNumber */ |
70 | | static int hf_q932_privateNumberDigits; /* NumberDigits */ |
71 | | static int hf_q932_userSpecifiedSubaddress; /* UserSpecifiedSubaddress */ |
72 | | static int hf_q932_nSAPSubaddress; /* NSAPSubaddress */ |
73 | | static int hf_q932_subaddressInformation; /* SubaddressInformation */ |
74 | | static int hf_q932_oddCountIndicator; /* BOOLEAN */ |
75 | | static int hf_q932_sourceEntity; /* EntityType */ |
76 | | static int hf_q932_sourceEntityAddress; /* AddressInformation */ |
77 | | static int hf_q932_destinationEntity; /* EntityType */ |
78 | | static int hf_q932_destinationEntityAddress; /* AddressInformation */ |
79 | | |
80 | | /* Initialize the subtree pointers */ |
81 | | static int ett_q932; |
82 | | static int ett_q932_ie; |
83 | | static int ett_q932_PresentedAddressScreened; |
84 | | static int ett_q932_PresentedAddressUnscreened; |
85 | | static int ett_q932_PresentedNumberScreened; |
86 | | static int ett_q932_PresentedNumberUnscreened; |
87 | | static int ett_q932_AddressScreened; |
88 | | static int ett_q932_NumberScreened; |
89 | | static int ett_q932_Address; |
90 | | static int ett_q932_PartyNumber; |
91 | | static int ett_q932_PublicPartyNumber; |
92 | | static int ett_q932_PrivatePartyNumber; |
93 | | static int ett_q932_PartySubaddress; |
94 | | static int ett_q932_UserSpecifiedSubaddress; |
95 | | static int ett_q932_NetworkFacilityExtension_U; |
96 | | |
97 | | static expert_field ei_q932_dse_not_supported; |
98 | | static expert_field ei_q932_acse_not_supported; |
99 | | static expert_field ei_q932_unknown_component; |
100 | | static expert_field ei_q932_asn1_encoded; |
101 | | |
102 | | |
103 | | /* Preferences */ |
104 | | |
105 | | /* ROSE context */ |
106 | | static rose_ctx_t q932_rose_ctx; |
107 | | |
108 | | dissector_table_t qsig_arg_local_dissector_table; |
109 | | dissector_table_t qsig_res_local_dissector_table; |
110 | | dissector_table_t qsig_err_local_dissector_table; |
111 | | |
112 | | dissector_table_t etsi_arg_local_dissector_table; |
113 | | dissector_table_t etsi_res_local_dissector_table; |
114 | | dissector_table_t etsi_err_local_dissector_table; |
115 | | |
116 | 28 | #define FACILITY_QSIG 0 |
117 | 14 | #define FACILITY_ETSI 1 |
118 | | static int g_facility_encoding = FACILITY_QSIG; |
119 | | |
120 | | void proto_reg_handoff_q932(void); |
121 | | |
122 | | static dissector_handle_t q932_ie_handle; |
123 | | |
124 | | /* Subdissectors */ |
125 | | static dissector_handle_t q932_ros_handle; |
126 | | |
127 | | #define Q932_IE_EXTENDED_FACILITY 0x0D |
128 | 96 | #define Q932_IE_FACILITY 0x1C |
129 | 218 | #define Q932_IE_NOTIFICATION_INDICATOR 0x27 |
130 | | #define Q932_IE_INFORMATION_REQUEST 0x32 |
131 | | #define Q932_IE_FEATURE_ACTIVATION 0x38 |
132 | | #define Q932_IE_FEATURE_INDICATION 0x39 |
133 | | #define Q932_IE_SERVICE_PROFILE_ID 0x3A |
134 | | #define Q932_IE_ENDPOINT_IDENTIFIER 0x3B |
135 | | static const value_string q932_str_ie_type[] = { |
136 | | { Q932_IE_EXTENDED_FACILITY , "Extended facility" }, |
137 | | { Q932_IE_FACILITY , "Facility" }, |
138 | | { Q932_IE_NOTIFICATION_INDICATOR, "Notification indicator" }, |
139 | | { Q932_IE_INFORMATION_REQUEST, "Information request" }, |
140 | | { Q932_IE_FEATURE_ACTIVATION , "Feature activation" }, |
141 | | { Q932_IE_FEATURE_INDICATION , "Feature indication" }, |
142 | | { Q932_IE_SERVICE_PROFILE_ID , "Service profile identification" }, |
143 | | { Q932_IE_ENDPOINT_IDENTIFIER, "Endpoint identifier" }, |
144 | | { 0, NULL} |
145 | | }; |
146 | | |
147 | | static const value_string str_pp[] = { |
148 | | { 0x11 , "Remote Operations Protocol" }, |
149 | | { 0x12 , "CMIP Protocol" }, |
150 | | { 0x13 , "ACSE Protocol" }, |
151 | | { 0x1F , "Networking extensions" }, |
152 | | { 0, NULL} |
153 | | }; |
154 | | |
155 | | static const value_string str_nd[] = { |
156 | | { 0x00 , "User suspended" }, |
157 | | { 0x01 , "User resume" }, |
158 | | { 0x02 , "Bearer service change" }, |
159 | | { 0x04 , "Call completion delay" }, |
160 | | { 0x03 , "Discriminator for extension to ASN.1 encoded component" }, |
161 | | { 0x40 , "Discriminator for extension to ASN.1 encoded component for ISO" }, |
162 | | { 0x42 , "Conference established" }, |
163 | | { 0x43 , "Conference disconnected" }, |
164 | | { 0x44 , "Other party added" }, |
165 | | { 0x45 , "Isolated" }, |
166 | | { 0x46 , "Reattached" }, |
167 | | { 0x47 , "Other party isolated" }, |
168 | | { 0x48 , "Other party reattached" }, |
169 | | { 0x49 , "Other party split" }, |
170 | | { 0x4A , "Other party disconnected" }, |
171 | | { 0x4B , "Conference floating" }, |
172 | | { 0x4C , "Conference disconnected, pre-emption" }, |
173 | | { 0x4F , "Conference floating, served user pre-empted" }, |
174 | | { 0x60 , "Call is a waiting call" }, |
175 | | { 0x68 , "Diversion activated" }, |
176 | | { 0x69 , "call transferred, alerting" }, |
177 | | { 0x6A , "call transferred, answered" }, |
178 | | { 0x6E , "reverse charging (whole call)" }, |
179 | | { 0x6F , "reverse charging (for the rest of the call)" }, |
180 | | { 0x74 , "service profile update" }, |
181 | | { 0x79 , "Remote hold" }, |
182 | | { 0x7A , "Remote retrieval" }, |
183 | | { 0x7B , "Call is diverting" }, |
184 | | { 0, NULL} |
185 | | }; |
186 | | |
187 | | |
188 | | |
189 | | static unsigned |
190 | 0 | dissect_q932_NumberDigits(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
191 | 0 | offset = dissect_ber_constrained_restricted_string(implicit_tag, BER_UNI_TAG_NumericString, |
192 | 0 | actx, tree, tvb, offset, |
193 | 0 | 1, 20, hf_index, NULL); |
194 | |
|
195 | 0 | return offset; |
196 | 0 | } |
197 | | |
198 | | |
199 | | static const value_string q932_PublicTypeOfNumber_vals[] = { |
200 | | { 0, "unknown" }, |
201 | | { 1, "internationalNumber" }, |
202 | | { 2, "nationalNumber" }, |
203 | | { 3, "networkSpecificNumber" }, |
204 | | { 4, "subscriberNumber" }, |
205 | | { 6, "abbreviatedNumber" }, |
206 | | { 0, NULL } |
207 | | }; |
208 | | |
209 | | |
210 | | static unsigned |
211 | 0 | dissect_q932_PublicTypeOfNumber(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
212 | 0 | offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, |
213 | 0 | NULL); |
214 | |
|
215 | 0 | return offset; |
216 | 0 | } |
217 | | |
218 | | |
219 | | static const ber_sequence_t PublicPartyNumber_sequence[] = { |
220 | | { &hf_q932_publicTypeOfNumber, BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_q932_PublicTypeOfNumber }, |
221 | | { &hf_q932_publicNumberDigits, BER_CLASS_UNI, BER_UNI_TAG_NumericString, BER_FLAGS_NOOWNTAG, dissect_q932_NumberDigits }, |
222 | | { NULL, 0, 0, 0, NULL } |
223 | | }; |
224 | | |
225 | | static unsigned |
226 | 0 | dissect_q932_PublicPartyNumber(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
227 | 0 | offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset, |
228 | 0 | PublicPartyNumber_sequence, hf_index, ett_q932_PublicPartyNumber); |
229 | |
|
230 | 0 | return offset; |
231 | 0 | } |
232 | | |
233 | | |
234 | | |
235 | | static unsigned |
236 | 0 | dissect_q932_NsapEncodedNumber(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
237 | 0 | offset = dissect_ber_constrained_octet_string(implicit_tag, actx, tree, tvb, offset, |
238 | 0 | 20, 20, hf_index, NULL); |
239 | |
|
240 | 0 | return offset; |
241 | 0 | } |
242 | | |
243 | | |
244 | | static const value_string q932_PrivateTypeOfNumber_vals[] = { |
245 | | { 0, "unknown" }, |
246 | | { 1, "level2RegionalNumber" }, |
247 | | { 2, "level1RegionalNumber" }, |
248 | | { 3, "pTNSpecificNumber" }, |
249 | | { 4, "localNumber" }, |
250 | | { 6, "abbreviatedNumber" }, |
251 | | { 0, NULL } |
252 | | }; |
253 | | |
254 | | |
255 | | static unsigned |
256 | 0 | dissect_q932_PrivateTypeOfNumber(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
257 | 0 | offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, |
258 | 0 | NULL); |
259 | |
|
260 | 0 | return offset; |
261 | 0 | } |
262 | | |
263 | | |
264 | | static const ber_sequence_t PrivatePartyNumber_sequence[] = { |
265 | | { &hf_q932_privateTypeOfNumber, BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_q932_PrivateTypeOfNumber }, |
266 | | { &hf_q932_privateNumberDigits, BER_CLASS_UNI, BER_UNI_TAG_NumericString, BER_FLAGS_NOOWNTAG, dissect_q932_NumberDigits }, |
267 | | { NULL, 0, 0, 0, NULL } |
268 | | }; |
269 | | |
270 | | static unsigned |
271 | 0 | dissect_q932_PrivatePartyNumber(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
272 | 0 | offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset, |
273 | 0 | PrivatePartyNumber_sequence, hf_index, ett_q932_PrivatePartyNumber); |
274 | |
|
275 | 0 | return offset; |
276 | 0 | } |
277 | | |
278 | | |
279 | | const value_string q932_PartyNumber_vals[] = { |
280 | | { 0, "unknownPartyNumber" }, |
281 | | { 1, "publicPartyNumber" }, |
282 | | { 2, "nsapEncodedNumber" }, |
283 | | { 3, "dataPartyNumber" }, |
284 | | { 4, "telexPartyNumber" }, |
285 | | { 5, "privatePartyNumber" }, |
286 | | { 8, "nationalStandardPartyNumber" }, |
287 | | { 0, NULL } |
288 | | }; |
289 | | |
290 | | static const ber_choice_t PartyNumber_choice[] = { |
291 | | { 0, &hf_q932_unknownPartyNumber, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_q932_NumberDigits }, |
292 | | { 1, &hf_q932_publicPartyNumber, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_q932_PublicPartyNumber }, |
293 | | { 2, &hf_q932_nsapEncodedNumber, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_q932_NsapEncodedNumber }, |
294 | | { 3, &hf_q932_dataPartyNumber, BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_q932_NumberDigits }, |
295 | | { 4, &hf_q932_telexPartyNumber, BER_CLASS_CON, 4, BER_FLAGS_IMPLTAG, dissect_q932_NumberDigits }, |
296 | | { 5, &hf_q932_privatePartyNumber, BER_CLASS_CON, 5, BER_FLAGS_IMPLTAG, dissect_q932_PrivatePartyNumber }, |
297 | | { 8, &hf_q932_nationalStandardPartyNumber, BER_CLASS_CON, 8, BER_FLAGS_IMPLTAG, dissect_q932_NumberDigits }, |
298 | | { 0, NULL, 0, 0, 0, NULL } |
299 | | }; |
300 | | |
301 | | unsigned |
302 | 0 | dissect_q932_PartyNumber(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
303 | 0 | offset = dissect_ber_choice(actx, tree, tvb, offset, |
304 | 0 | PartyNumber_choice, hf_index, ett_q932_PartyNumber, |
305 | 0 | NULL); |
306 | |
|
307 | 0 | return offset; |
308 | 0 | } |
309 | | |
310 | | |
311 | | const value_string q932_ScreeningIndicator_vals[] = { |
312 | | { 0, "userProvidedNotScreened" }, |
313 | | { 1, "userProvidedVerifiedAndPassed" }, |
314 | | { 2, "userProvidedVerifiedAndFailed" }, |
315 | | { 3, "networkProvided" }, |
316 | | { 0, NULL } |
317 | | }; |
318 | | |
319 | | |
320 | | unsigned |
321 | 0 | dissect_q932_ScreeningIndicator(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
322 | 0 | offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, |
323 | 0 | NULL); |
324 | |
|
325 | 0 | return offset; |
326 | 0 | } |
327 | | |
328 | | |
329 | | |
330 | | static unsigned |
331 | 0 | dissect_q932_SubaddressInformation(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
332 | 0 | offset = dissect_ber_constrained_octet_string(implicit_tag, actx, tree, tvb, offset, |
333 | 0 | 1, 20, hf_index, NULL); |
334 | |
|
335 | 0 | return offset; |
336 | 0 | } |
337 | | |
338 | | |
339 | | |
340 | | static unsigned |
341 | 0 | dissect_q932_BOOLEAN(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
342 | 0 | offset = dissect_ber_boolean(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); |
343 | |
|
344 | 0 | return offset; |
345 | 0 | } |
346 | | |
347 | | |
348 | | static const ber_sequence_t UserSpecifiedSubaddress_sequence[] = { |
349 | | { &hf_q932_subaddressInformation, BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_q932_SubaddressInformation }, |
350 | | { &hf_q932_oddCountIndicator, BER_CLASS_UNI, BER_UNI_TAG_BOOLEAN, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_q932_BOOLEAN }, |
351 | | { NULL, 0, 0, 0, NULL } |
352 | | }; |
353 | | |
354 | | static unsigned |
355 | 0 | dissect_q932_UserSpecifiedSubaddress(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
356 | 0 | offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset, |
357 | 0 | UserSpecifiedSubaddress_sequence, hf_index, ett_q932_UserSpecifiedSubaddress); |
358 | |
|
359 | 0 | return offset; |
360 | 0 | } |
361 | | |
362 | | |
363 | | |
364 | | static unsigned |
365 | 0 | dissect_q932_NSAPSubaddress(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
366 | 0 | offset = dissect_ber_constrained_octet_string(implicit_tag, actx, tree, tvb, offset, |
367 | 0 | 1, 20, hf_index, NULL); |
368 | |
|
369 | 0 | return offset; |
370 | 0 | } |
371 | | |
372 | | |
373 | | const value_string q932_PartySubaddress_vals[] = { |
374 | | { 0, "userSpecifiedSubaddress" }, |
375 | | { 1, "nSAPSubaddress" }, |
376 | | { 0, NULL } |
377 | | }; |
378 | | |
379 | | static const ber_choice_t PartySubaddress_choice[] = { |
380 | | { 0, &hf_q932_userSpecifiedSubaddress, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_q932_UserSpecifiedSubaddress }, |
381 | | { 1, &hf_q932_nSAPSubaddress , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_q932_NSAPSubaddress }, |
382 | | { 0, NULL, 0, 0, 0, NULL } |
383 | | }; |
384 | | |
385 | | unsigned |
386 | 0 | dissect_q932_PartySubaddress(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
387 | 0 | offset = dissect_ber_choice(actx, tree, tvb, offset, |
388 | 0 | PartySubaddress_choice, hf_index, ett_q932_PartySubaddress, |
389 | 0 | NULL); |
390 | |
|
391 | 0 | return offset; |
392 | 0 | } |
393 | | |
394 | | |
395 | | static const ber_sequence_t AddressScreened_sequence[] = { |
396 | | { &hf_q932_partyNumber , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_q932_PartyNumber }, |
397 | | { &hf_q932_screeninglndicator, BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_q932_ScreeningIndicator }, |
398 | | { &hf_q932_partySubaddress, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_q932_PartySubaddress }, |
399 | | { NULL, 0, 0, 0, NULL } |
400 | | }; |
401 | | |
402 | | static unsigned |
403 | 0 | dissect_q932_AddressScreened(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
404 | 0 | offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset, |
405 | 0 | AddressScreened_sequence, hf_index, ett_q932_AddressScreened); |
406 | |
|
407 | 0 | return offset; |
408 | 0 | } |
409 | | |
410 | | |
411 | | |
412 | | static unsigned |
413 | 0 | dissect_q932_NULL(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
414 | 0 | offset = dissect_ber_null(implicit_tag, actx, tree, tvb, offset, hf_index); |
415 | |
|
416 | 0 | return offset; |
417 | 0 | } |
418 | | |
419 | | |
420 | | const value_string q932_PresentedAddressScreened_vals[] = { |
421 | | { 0, "presentationAlIowedAddress" }, |
422 | | { 1, "presentationRestricted" }, |
423 | | { 2, "numberNotAvailableDueTolnterworking" }, |
424 | | { 3, "presentationRestrictedAddress" }, |
425 | | { 0, NULL } |
426 | | }; |
427 | | |
428 | | static const ber_choice_t PresentedAddressScreened_choice[] = { |
429 | | { 0, &hf_q932_presentationAlIowedAddress, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_q932_AddressScreened }, |
430 | | { 1, &hf_q932_presentationRestricted, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_q932_NULL }, |
431 | | { 2, &hf_q932_numberNotAvailableDueTolnterworking, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_q932_NULL }, |
432 | | { 3, &hf_q932_presentationRestrictedAddressScreened, BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_q932_AddressScreened }, |
433 | | { 0, NULL, 0, 0, 0, NULL } |
434 | | }; |
435 | | |
436 | | unsigned |
437 | 0 | dissect_q932_PresentedAddressScreened(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
438 | 0 | offset = dissect_ber_choice(actx, tree, tvb, offset, |
439 | 0 | PresentedAddressScreened_choice, hf_index, ett_q932_PresentedAddressScreened, |
440 | 0 | NULL); |
441 | |
|
442 | 0 | return offset; |
443 | 0 | } |
444 | | |
445 | | |
446 | | static const ber_sequence_t Address_sequence[] = { |
447 | | { &hf_q932_partyNumber , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_q932_PartyNumber }, |
448 | | { &hf_q932_partySubaddress, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_q932_PartySubaddress }, |
449 | | { NULL, 0, 0, 0, NULL } |
450 | | }; |
451 | | |
452 | | unsigned |
453 | 0 | dissect_q932_Address(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
454 | 0 | offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset, |
455 | 0 | Address_sequence, hf_index, ett_q932_Address); |
456 | |
|
457 | 0 | return offset; |
458 | 0 | } |
459 | | |
460 | | |
461 | | const value_string q932_PresentedAddressUnscreened_vals[] = { |
462 | | { 0, "presentationAllowedAddress" }, |
463 | | { 1, "presentationRestricted" }, |
464 | | { 2, "numberNotAvailableDueTolnterworking" }, |
465 | | { 3, "presentationRestrictedAddress" }, |
466 | | { 0, NULL } |
467 | | }; |
468 | | |
469 | | static const ber_choice_t PresentedAddressUnscreened_choice[] = { |
470 | | { 0, &hf_q932_presentationAllowedAddress, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_q932_Address }, |
471 | | { 1, &hf_q932_presentationRestricted, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_q932_NULL }, |
472 | | { 2, &hf_q932_numberNotAvailableDueTolnterworking, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_q932_NULL }, |
473 | | { 3, &hf_q932_presentationRestrictedAddress, BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_q932_Address }, |
474 | | { 0, NULL, 0, 0, 0, NULL } |
475 | | }; |
476 | | |
477 | | unsigned |
478 | 0 | dissect_q932_PresentedAddressUnscreened(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
479 | 0 | offset = dissect_ber_choice(actx, tree, tvb, offset, |
480 | 0 | PresentedAddressUnscreened_choice, hf_index, ett_q932_PresentedAddressUnscreened, |
481 | 0 | NULL); |
482 | |
|
483 | 0 | return offset; |
484 | 0 | } |
485 | | |
486 | | |
487 | | static const ber_sequence_t NumberScreened_sequence[] = { |
488 | | { &hf_q932_partyNumber , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_q932_PartyNumber }, |
489 | | { &hf_q932_screeningIndicator, BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_q932_ScreeningIndicator }, |
490 | | { NULL, 0, 0, 0, NULL } |
491 | | }; |
492 | | |
493 | | static unsigned |
494 | 0 | dissect_q932_NumberScreened(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
495 | 0 | offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset, |
496 | 0 | NumberScreened_sequence, hf_index, ett_q932_NumberScreened); |
497 | |
|
498 | 0 | return offset; |
499 | 0 | } |
500 | | |
501 | | |
502 | | const value_string q932_PresentedNumberScreened_vals[] = { |
503 | | { 0, "presentationAllowedNumber" }, |
504 | | { 1, "presentationRestricted" }, |
505 | | { 2, "numberNotAvailableDueToInterworking" }, |
506 | | { 3, "presentationRestrictedNumber" }, |
507 | | { 0, NULL } |
508 | | }; |
509 | | |
510 | | static const ber_choice_t PresentedNumberScreened_choice[] = { |
511 | | { 0, &hf_q932_presentationAllowedNumberScreened, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_q932_NumberScreened }, |
512 | | { 1, &hf_q932_presentationRestricted, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_q932_NULL }, |
513 | | { 2, &hf_q932_numberNotAvailableDueToInterworking, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_q932_NULL }, |
514 | | { 3, &hf_q932_presentationRestrictedNumberScreened, BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_q932_NumberScreened }, |
515 | | { 0, NULL, 0, 0, 0, NULL } |
516 | | }; |
517 | | |
518 | | unsigned |
519 | 0 | dissect_q932_PresentedNumberScreened(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
520 | 0 | offset = dissect_ber_choice(actx, tree, tvb, offset, |
521 | 0 | PresentedNumberScreened_choice, hf_index, ett_q932_PresentedNumberScreened, |
522 | 0 | NULL); |
523 | |
|
524 | 0 | return offset; |
525 | 0 | } |
526 | | |
527 | | |
528 | | const value_string q932_PresentedNumberUnscreened_vals[] = { |
529 | | { 0, "presentationAllowedNumber" }, |
530 | | { 1, "presentationRestricted" }, |
531 | | { 2, "numberNotAvailableDueToInterworking" }, |
532 | | { 3, "presentationRestrictedNumber" }, |
533 | | { 0, NULL } |
534 | | }; |
535 | | |
536 | | static const ber_choice_t PresentedNumberUnscreened_choice[] = { |
537 | | { 0, &hf_q932_presentationAllowedNumber, BER_CLASS_CON, 0, 0, dissect_q932_PartyNumber }, |
538 | | { 1, &hf_q932_presentationRestricted, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_q932_NULL }, |
539 | | { 2, &hf_q932_numberNotAvailableDueToInterworking, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_q932_NULL }, |
540 | | { 3, &hf_q932_presentationRestrictedNumber, BER_CLASS_CON, 3, 0, dissect_q932_PartyNumber }, |
541 | | { 0, NULL, 0, 0, 0, NULL } |
542 | | }; |
543 | | |
544 | | unsigned |
545 | 0 | dissect_q932_PresentedNumberUnscreened(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
546 | 0 | offset = dissect_ber_choice(actx, tree, tvb, offset, |
547 | 0 | PresentedNumberUnscreened_choice, hf_index, ett_q932_PresentedNumberUnscreened, |
548 | 0 | NULL); |
549 | |
|
550 | 0 | return offset; |
551 | 0 | } |
552 | | |
553 | | |
554 | | |
555 | | unsigned |
556 | 0 | dissect_q932_PresentationAllowedIndicator(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
557 | 0 | offset = dissect_ber_boolean(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); |
558 | |
|
559 | 0 | return offset; |
560 | 0 | } |
561 | | |
562 | | |
563 | | static const value_string q932_EntityType_vals[] = { |
564 | | { 0, "endPINX" }, |
565 | | { 1, "anyTypeOfPINX" }, |
566 | | { 0, NULL } |
567 | | }; |
568 | | |
569 | | |
570 | | static unsigned |
571 | 0 | dissect_q932_EntityType(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
572 | 0 | offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, |
573 | 0 | NULL); |
574 | |
|
575 | 0 | return offset; |
576 | 0 | } |
577 | | |
578 | | |
579 | | |
580 | | static unsigned |
581 | 0 | dissect_q932_AddressInformation(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
582 | 0 | offset = dissect_q932_PartyNumber(implicit_tag, tvb, offset, actx, tree, hf_index); |
583 | |
|
584 | 0 | return offset; |
585 | 0 | } |
586 | | |
587 | | |
588 | | static const ber_sequence_t NetworkFacilityExtension_U_sequence[] = { |
589 | | { &hf_q932_sourceEntity , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_q932_EntityType }, |
590 | | { &hf_q932_sourceEntityAddress, BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_NOTCHKTAG, dissect_q932_AddressInformation }, |
591 | | { &hf_q932_destinationEntity, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_q932_EntityType }, |
592 | | { &hf_q932_destinationEntityAddress, BER_CLASS_CON, 3, BER_FLAGS_OPTIONAL|BER_FLAGS_NOTCHKTAG, dissect_q932_AddressInformation }, |
593 | | { NULL, 0, 0, 0, NULL } |
594 | | }; |
595 | | |
596 | | static unsigned |
597 | 2 | dissect_q932_NetworkFacilityExtension_U(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
598 | 2 | offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset, |
599 | 2 | NetworkFacilityExtension_U_sequence, hf_index, ett_q932_NetworkFacilityExtension_U); |
600 | | |
601 | 2 | return offset; |
602 | 2 | } |
603 | | |
604 | | |
605 | | |
606 | | static unsigned |
607 | 2 | dissect_q932_NetworkFacilityExtension(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
608 | 2 | offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset, |
609 | 2 | hf_index, BER_CLASS_CON, 10, true, dissect_q932_NetworkFacilityExtension_U); |
610 | | |
611 | 2 | return offset; |
612 | 2 | } |
613 | | |
614 | | |
615 | | static const value_string q932_NetworkProtocolProfile_U_vals[] = { |
616 | | { 19, "acse" }, |
617 | | { 32, "dse" }, |
618 | | { 0, NULL } |
619 | | }; |
620 | | |
621 | | |
622 | | static unsigned |
623 | 2 | dissect_q932_NetworkProtocolProfile_U(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
624 | 2 | offset = dissect_ber_constrained_integer(implicit_tag, actx, tree, tvb, offset, |
625 | 2 | 0U, 254U, hf_index, NULL); |
626 | | |
627 | 2 | return offset; |
628 | 2 | } |
629 | | |
630 | | |
631 | | |
632 | | static unsigned |
633 | 2 | dissect_q932_NetworkProtocolProfile(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
634 | 2 | offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset, |
635 | 2 | hf_index, BER_CLASS_CON, 18, true, dissect_q932_NetworkProtocolProfile_U); |
636 | | |
637 | 2 | return offset; |
638 | 2 | } |
639 | | |
640 | | |
641 | | static const value_string q932_InterpretationComponent_U_vals[] = { |
642 | | { 0, "discardAnyUnrecognisedInvokePdu" }, |
643 | | { 1, "clearCallIfAnyInvokePduNotRecognised" }, |
644 | | { 2, "rejectAnyUnrecognisedInvokePdu" }, |
645 | | { 0, NULL } |
646 | | }; |
647 | | |
648 | | |
649 | | static unsigned |
650 | 2 | dissect_q932_InterpretationComponent_U(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
651 | 2 | offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, |
652 | 2 | NULL); |
653 | | |
654 | 2 | return offset; |
655 | 2 | } |
656 | | |
657 | | |
658 | | |
659 | | static unsigned |
660 | 2 | dissect_q932_InterpretationComponent(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
661 | 2 | offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset, |
662 | 2 | hf_index, BER_CLASS_CON, 11, true, dissect_q932_InterpretationComponent_U); |
663 | | |
664 | 2 | return offset; |
665 | 2 | } |
666 | | |
667 | | /*--- PDUs ---*/ |
668 | | |
669 | 2 | static int dissect_NetworkFacilityExtension_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) { |
670 | 2 | unsigned offset = 0; |
671 | 2 | asn1_ctx_t asn1_ctx; |
672 | 2 | asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo); |
673 | 2 | offset = dissect_q932_NetworkFacilityExtension(false, tvb, offset, &asn1_ctx, tree, hf_q932_NetworkFacilityExtension_PDU); |
674 | 2 | return offset; |
675 | 2 | } |
676 | 2 | static int dissect_NetworkProtocolProfile_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) { |
677 | 2 | unsigned offset = 0; |
678 | 2 | asn1_ctx_t asn1_ctx; |
679 | 2 | asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo); |
680 | 2 | offset = dissect_q932_NetworkProtocolProfile(false, tvb, offset, &asn1_ctx, tree, hf_q932_NetworkProtocolProfile_PDU); |
681 | 2 | return offset; |
682 | 2 | } |
683 | 2 | static int dissect_InterpretationComponent_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) { |
684 | 2 | unsigned offset = 0; |
685 | 2 | asn1_ctx_t asn1_ctx; |
686 | 2 | asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo); |
687 | 2 | offset = dissect_q932_InterpretationComponent(false, tvb, offset, &asn1_ctx, tree, hf_q932_InterpretationComponent_PDU); |
688 | 2 | return offset; |
689 | 2 | } |
690 | | |
691 | | |
692 | | /*--- dissect_q932_facility_ie -------------------------------------------------------*/ |
693 | | static void |
694 | 82 | dissect_q932_facility_ie(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int length) { |
695 | 82 | int8_t appclass; |
696 | 82 | bool pc; |
697 | 82 | int32_t tag; |
698 | 82 | uint32_t len; |
699 | 82 | int hoffset, eoffset; |
700 | 82 | int ie_end; |
701 | 82 | tvbuff_t *next_tvb; |
702 | | |
703 | 82 | ie_end = offset + length; |
704 | 82 | proto_tree_add_item(tree, hf_q932_pp, tvb, offset, 1, ENC_BIG_ENDIAN); |
705 | 82 | offset++; |
706 | 759 | while (offset < ie_end) { |
707 | 751 | hoffset = offset; |
708 | 751 | offset = get_ber_identifier(tvb, offset, &appclass, &pc, &tag); |
709 | 751 | offset = get_ber_length(tvb, offset, &len, NULL); |
710 | 751 | eoffset = offset + len; |
711 | 751 | next_tvb = tvb_new_subset_length(tvb, hoffset, eoffset - hoffset); |
712 | 751 | switch (appclass) { |
713 | 69 | case BER_CLASS_CON: |
714 | 69 | switch (tag) { |
715 | 2 | case 10 : /* Network Facility Extension */ |
716 | 2 | dissect_NetworkFacilityExtension_PDU(next_tvb, pinfo, tree, NULL); |
717 | 2 | break; |
718 | 2 | case 18 : /* Network Protocol Profile */ |
719 | 2 | dissect_NetworkProtocolProfile_PDU(next_tvb, pinfo, tree, NULL); |
720 | 2 | break; |
721 | 2 | case 11 : /* Interpretation Component */ |
722 | 2 | dissect_InterpretationComponent_PDU(next_tvb, pinfo, tree, NULL); |
723 | 2 | break; |
724 | | /* ROSE APDU */ |
725 | 13 | case 1 : /* invoke */ |
726 | 20 | case 2 : /* returnResult */ |
727 | 26 | case 3 : /* returnError */ |
728 | 32 | case 4 : /* reject */ |
729 | 32 | q932_rose_ctx.apdu_depth = 1; |
730 | 32 | call_dissector_with_data(q932_ros_handle, next_tvb, pinfo, tree, &q932_rose_ctx); |
731 | 32 | break; |
732 | | /* DSE APDU */ |
733 | 2 | case 12 : /* begin */ |
734 | 4 | case 14 : /* end */ |
735 | 5 | case 15 : /* continue */ |
736 | 8 | case 17 : /* abort */ |
737 | 8 | offset = dissect_ber_identifier(pinfo, tree, tvb, hoffset, NULL, NULL, NULL); |
738 | 8 | offset = dissect_ber_length(pinfo, tree, tvb, offset, NULL, NULL); |
739 | 8 | proto_tree_add_expert(tree, pinfo, &ei_q932_dse_not_supported, tvb, offset, len); |
740 | 8 | break; |
741 | 23 | default: |
742 | 23 | offset = dissect_ber_identifier(pinfo, tree, tvb, hoffset, NULL, NULL, NULL); |
743 | 23 | offset = dissect_ber_length(pinfo, tree, tvb, offset, NULL, NULL); |
744 | 23 | proto_tree_add_expert(tree, pinfo, &ei_q932_unknown_component, tvb, offset, len); |
745 | 69 | } |
746 | 45 | break; |
747 | 58 | case BER_CLASS_APP: |
748 | 58 | switch (tag) { |
749 | | /* ACSE APDU */ |
750 | 2 | case 0 : /* aarq */ |
751 | 6 | case 1 : /* aare */ |
752 | 8 | case 2 : /* rlrq */ |
753 | 8 | case 3 : /* rlre */ |
754 | 12 | case 4 : /* abrt */ |
755 | 12 | offset = dissect_ber_identifier(pinfo, tree, tvb, hoffset, NULL, NULL, NULL); |
756 | 12 | offset = dissect_ber_length(pinfo, tree, tvb, offset, NULL, NULL); |
757 | 12 | proto_tree_add_expert(tree, pinfo, &ei_q932_acse_not_supported, tvb, offset, len); |
758 | 12 | break; |
759 | 46 | default: |
760 | 46 | offset = dissect_ber_identifier(pinfo, tree, tvb, hoffset, NULL, NULL, NULL); |
761 | 46 | offset = dissect_ber_length(pinfo, tree, tvb, offset, NULL, NULL); |
762 | 46 | proto_tree_add_expert(tree, pinfo, &ei_q932_unknown_component, tvb, offset, len); |
763 | 58 | } |
764 | 49 | break; |
765 | 604 | default: |
766 | 604 | offset = dissect_ber_identifier(pinfo, tree, tvb, hoffset, NULL, NULL, NULL); |
767 | 604 | offset = dissect_ber_length(pinfo, tree, tvb, offset, NULL, NULL); |
768 | 604 | proto_tree_add_expert(tree, pinfo, &ei_q932_unknown_component, tvb, offset, len); |
769 | 751 | } |
770 | 677 | offset = eoffset; |
771 | 677 | } |
772 | 82 | } |
773 | | |
774 | | /*--- dissect_q932_ni_ie -------------------------------------------------------*/ |
775 | | static void |
776 | 204 | dissect_q932_ni_ie(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int length) { |
777 | 204 | int remain = length; |
778 | 204 | uint8_t octet = 0; |
779 | 204 | uint32_t value = 0; |
780 | 204 | proto_item* ti; |
781 | | |
782 | 2.58k | while ((remain > 0) && !(octet & 0x80)) { |
783 | 2.37k | octet = tvb_get_uint8(tvb, offset++); |
784 | 2.37k | remain--; |
785 | 2.37k | value <<= 7; |
786 | 2.37k | value |= octet & 0x7F; |
787 | 2.37k | } |
788 | 204 | ti = proto_tree_add_uint(tree, hf_q932_nd, tvb, offset - (length - remain), length - remain, value); |
789 | | |
790 | 204 | if (remain > 0) { |
791 | 120 | expert_add_info(pinfo, ti, &ei_q932_asn1_encoded); |
792 | 120 | } |
793 | 204 | } |
794 | | |
795 | | /*--- dissect_q932_ie -------------------------------------------------------*/ |
796 | | static int |
797 | 299 | dissect_q932_ie(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { |
798 | 299 | int offset; |
799 | 299 | proto_item *ti; |
800 | 299 | proto_tree *ie_tree; |
801 | 299 | uint8_t ie_type, ie_len; |
802 | | |
803 | 299 | offset = 0; |
804 | | |
805 | 299 | ti = proto_tree_add_item(tree, proto_q932, tvb, offset, -1, ENC_NA); |
806 | 299 | proto_item_set_hidden(ti); |
807 | | |
808 | 299 | ie_type = tvb_get_uint8(tvb, offset); |
809 | 299 | ie_len = tvb_get_uint8(tvb, offset + 1); |
810 | | |
811 | 299 | ie_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_q932_ie, NULL, |
812 | 299 | val_to_str(pinfo->pool, ie_type, VALS(q932_str_ie_type), "unknown (0x%02X)")); |
813 | | |
814 | 299 | proto_tree_add_item(ie_tree, hf_q932_ie_type, tvb, offset, 1, ENC_BIG_ENDIAN); |
815 | 299 | proto_tree_add_item(ie_tree, hf_q932_ie_len, tvb, offset + 1, 1, ENC_BIG_ENDIAN); |
816 | 299 | offset += 2; |
817 | 299 | if (tvb_reported_length_remaining(tvb, offset) <= 0) |
818 | 13 | return offset; |
819 | 286 | switch (ie_type) { |
820 | 82 | case Q932_IE_FACILITY : |
821 | 82 | dissect_q932_facility_ie(tvb, offset, pinfo, ie_tree, ie_len); |
822 | 82 | break; |
823 | 204 | case Q932_IE_NOTIFICATION_INDICATOR : |
824 | 204 | dissect_q932_ni_ie(tvb, offset, pinfo, ie_tree, ie_len); |
825 | 204 | break; |
826 | 0 | default: |
827 | 0 | if (ie_len > 0) { |
828 | 0 | proto_tree_add_item(ie_tree, hf_q932_ie_data, tvb, offset, ie_len, ENC_NA); |
829 | 0 | } |
830 | 286 | } |
831 | 211 | return tvb_captured_length(tvb); |
832 | 286 | } |
833 | | |
834 | | /*--- dissect_q932_apdu -----------------------------------------------------*/ |
835 | | static int |
836 | 0 | dissect_q932_apdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { |
837 | 0 | return call_dissector(q932_ros_handle, tvb, pinfo, tree); |
838 | 0 | } |
839 | | |
840 | | /*--- proto_register_q932 ---------------------------------------------------*/ |
841 | 14 | void proto_register_q932(void) { |
842 | | |
843 | | /* List of fields */ |
844 | 14 | static hf_register_info hf[] = { |
845 | 14 | { &hf_q932_ie_type, { "Type", "q932.ie.type", |
846 | 14 | FT_UINT8, BASE_HEX, VALS(q932_str_ie_type), 0x0, |
847 | 14 | "Information Element Type", HFILL }}, |
848 | 14 | { &hf_q932_ie_len, { "Length", "q932.ie.len", |
849 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
850 | 14 | "Information Element Length", HFILL }}, |
851 | 14 | { &hf_q932_ie_data, { "Data", "q932.ie.data", |
852 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
853 | 14 | NULL, HFILL }}, |
854 | 14 | { &hf_q932_pp, { "Protocol profile", "q932.pp", |
855 | 14 | FT_UINT8, BASE_HEX, VALS(str_pp), 0x1F, |
856 | 14 | NULL, HFILL }}, |
857 | 14 | { &hf_q932_nd, { "Notification description", "q932.nd", |
858 | 14 | FT_UINT8, BASE_HEX, VALS(str_nd), 0x0, |
859 | 14 | NULL, HFILL }}, |
860 | 14 | { &hf_q932_NetworkFacilityExtension_PDU, |
861 | 14 | { "NetworkFacilityExtension", "q932.NetworkFacilityExtension_element", |
862 | 14 | FT_NONE, BASE_NONE, NULL, 0, |
863 | 14 | NULL, HFILL }}, |
864 | 14 | { &hf_q932_NetworkProtocolProfile_PDU, |
865 | 14 | { "NetworkProtocolProfile", "q932.NetworkProtocolProfile", |
866 | 14 | FT_UINT32, BASE_DEC, VALS(q932_NetworkProtocolProfile_U_vals), 0, |
867 | 14 | NULL, HFILL }}, |
868 | 14 | { &hf_q932_InterpretationComponent_PDU, |
869 | 14 | { "InterpretationComponent", "q932.InterpretationComponent", |
870 | 14 | FT_UINT32, BASE_DEC, VALS(q932_InterpretationComponent_U_vals), 0, |
871 | 14 | NULL, HFILL }}, |
872 | 14 | { &hf_q932_presentationAlIowedAddress, |
873 | 14 | { "presentationAlIowedAddress", "q932.presentationAlIowedAddress_element", |
874 | 14 | FT_NONE, BASE_NONE, NULL, 0, |
875 | 14 | "AddressScreened", HFILL }}, |
876 | 14 | { &hf_q932_presentationRestricted, |
877 | 14 | { "presentationRestricted", "q932.presentationRestricted_element", |
878 | 14 | FT_NONE, BASE_NONE, NULL, 0, |
879 | 14 | NULL, HFILL }}, |
880 | 14 | { &hf_q932_numberNotAvailableDueTolnterworking, |
881 | 14 | { "numberNotAvailableDueTolnterworking", "q932.numberNotAvailableDueTolnterworking_element", |
882 | 14 | FT_NONE, BASE_NONE, NULL, 0, |
883 | 14 | NULL, HFILL }}, |
884 | 14 | { &hf_q932_presentationRestrictedAddressScreened, |
885 | 14 | { "presentationRestrictedAddress", "q932.presentationRestrictedAddressScreened_element", |
886 | 14 | FT_NONE, BASE_NONE, NULL, 0, |
887 | 14 | "AddressScreened", HFILL }}, |
888 | 14 | { &hf_q932_presentationAllowedAddress, |
889 | 14 | { "presentationAllowedAddress", "q932.presentationAllowedAddress_element", |
890 | 14 | FT_NONE, BASE_NONE, NULL, 0, |
891 | 14 | "Address", HFILL }}, |
892 | 14 | { &hf_q932_presentationRestrictedAddress, |
893 | 14 | { "presentationRestrictedAddress", "q932.presentationRestrictedAddress_element", |
894 | 14 | FT_NONE, BASE_NONE, NULL, 0, |
895 | 14 | "Address", HFILL }}, |
896 | 14 | { &hf_q932_presentationAllowedNumberScreened, |
897 | 14 | { "presentationAllowedNumber", "q932.presentationAllowedNumberScreened_element", |
898 | 14 | FT_NONE, BASE_NONE, NULL, 0, |
899 | 14 | "NumberScreened", HFILL }}, |
900 | 14 | { &hf_q932_numberNotAvailableDueToInterworking, |
901 | 14 | { "numberNotAvailableDueToInterworking", "q932.numberNotAvailableDueToInterworking_element", |
902 | 14 | FT_NONE, BASE_NONE, NULL, 0, |
903 | 14 | NULL, HFILL }}, |
904 | 14 | { &hf_q932_presentationRestrictedNumberScreened, |
905 | 14 | { "presentationRestrictedNumber", "q932.presentationRestrictedNumberScreened_element", |
906 | 14 | FT_NONE, BASE_NONE, NULL, 0, |
907 | 14 | "NumberScreened", HFILL }}, |
908 | 14 | { &hf_q932_presentationAllowedNumber, |
909 | 14 | { "presentationAllowedNumber", "q932.presentationAllowedNumber", |
910 | 14 | FT_UINT32, BASE_DEC, VALS(q932_PartyNumber_vals), 0, |
911 | 14 | "PartyNumber", HFILL }}, |
912 | 14 | { &hf_q932_presentationRestrictedNumber, |
913 | 14 | { "presentationRestrictedNumber", "q932.presentationRestrictedNumber", |
914 | 14 | FT_UINT32, BASE_DEC, VALS(q932_PartyNumber_vals), 0, |
915 | 14 | "PartyNumber", HFILL }}, |
916 | 14 | { &hf_q932_partyNumber, |
917 | 14 | { "partyNumber", "q932.partyNumber", |
918 | 14 | FT_UINT32, BASE_DEC, VALS(q932_PartyNumber_vals), 0, |
919 | 14 | NULL, HFILL }}, |
920 | 14 | { &hf_q932_screeninglndicator, |
921 | 14 | { "screeninglndicator", "q932.screeninglndicator", |
922 | 14 | FT_UINT32, BASE_DEC, VALS(q932_ScreeningIndicator_vals), 0, |
923 | 14 | "ScreeningIndicator", HFILL }}, |
924 | 14 | { &hf_q932_partySubaddress, |
925 | 14 | { "partySubaddress", "q932.partySubaddress", |
926 | 14 | FT_UINT32, BASE_DEC, VALS(q932_PartySubaddress_vals), 0, |
927 | 14 | NULL, HFILL }}, |
928 | 14 | { &hf_q932_screeningIndicator, |
929 | 14 | { "screeningIndicator", "q932.screeningIndicator", |
930 | 14 | FT_UINT32, BASE_DEC, VALS(q932_ScreeningIndicator_vals), 0, |
931 | 14 | NULL, HFILL }}, |
932 | 14 | { &hf_q932_unknownPartyNumber, |
933 | 14 | { "unknownPartyNumber", "q932.unknownPartyNumber", |
934 | 14 | FT_STRING, BASE_NONE, NULL, 0, |
935 | 14 | "NumberDigits", HFILL }}, |
936 | 14 | { &hf_q932_publicPartyNumber, |
937 | 14 | { "publicPartyNumber", "q932.publicPartyNumber_element", |
938 | 14 | FT_NONE, BASE_NONE, NULL, 0, |
939 | 14 | NULL, HFILL }}, |
940 | 14 | { &hf_q932_nsapEncodedNumber, |
941 | 14 | { "nsapEncodedNumber", "q932.nsapEncodedNumber", |
942 | 14 | FT_BYTES, BASE_NONE, NULL, 0, |
943 | 14 | NULL, HFILL }}, |
944 | 14 | { &hf_q932_dataPartyNumber, |
945 | 14 | { "dataPartyNumber", "q932.dataPartyNumber", |
946 | 14 | FT_STRING, BASE_NONE, NULL, 0, |
947 | 14 | "NumberDigits", HFILL }}, |
948 | 14 | { &hf_q932_telexPartyNumber, |
949 | 14 | { "telexPartyNumber", "q932.telexPartyNumber", |
950 | 14 | FT_STRING, BASE_NONE, NULL, 0, |
951 | 14 | "NumberDigits", HFILL }}, |
952 | 14 | { &hf_q932_privatePartyNumber, |
953 | 14 | { "privatePartyNumber", "q932.privatePartyNumber_element", |
954 | 14 | FT_NONE, BASE_NONE, NULL, 0, |
955 | 14 | NULL, HFILL }}, |
956 | 14 | { &hf_q932_nationalStandardPartyNumber, |
957 | 14 | { "nationalStandardPartyNumber", "q932.nationalStandardPartyNumber", |
958 | 14 | FT_STRING, BASE_NONE, NULL, 0, |
959 | 14 | "NumberDigits", HFILL }}, |
960 | 14 | { &hf_q932_publicTypeOfNumber, |
961 | 14 | { "publicTypeOfNumber", "q932.publicTypeOfNumber", |
962 | 14 | FT_UINT32, BASE_DEC, VALS(q932_PublicTypeOfNumber_vals), 0, |
963 | 14 | NULL, HFILL }}, |
964 | 14 | { &hf_q932_publicNumberDigits, |
965 | 14 | { "publicNumberDigits", "q932.publicNumberDigits", |
966 | 14 | FT_STRING, BASE_NONE, NULL, 0, |
967 | 14 | "NumberDigits", HFILL }}, |
968 | 14 | { &hf_q932_privateTypeOfNumber, |
969 | 14 | { "privateTypeOfNumber", "q932.privateTypeOfNumber", |
970 | 14 | FT_UINT32, BASE_DEC, VALS(q932_PrivateTypeOfNumber_vals), 0, |
971 | 14 | NULL, HFILL }}, |
972 | 14 | { &hf_q932_privateNumberDigits, |
973 | 14 | { "privateNumberDigits", "q932.privateNumberDigits", |
974 | 14 | FT_STRING, BASE_NONE, NULL, 0, |
975 | 14 | "NumberDigits", HFILL }}, |
976 | 14 | { &hf_q932_userSpecifiedSubaddress, |
977 | 14 | { "userSpecifiedSubaddress", "q932.userSpecifiedSubaddress_element", |
978 | 14 | FT_NONE, BASE_NONE, NULL, 0, |
979 | 14 | NULL, HFILL }}, |
980 | 14 | { &hf_q932_nSAPSubaddress, |
981 | 14 | { "nSAPSubaddress", "q932.nSAPSubaddress", |
982 | 14 | FT_BYTES, BASE_NONE, NULL, 0, |
983 | 14 | NULL, HFILL }}, |
984 | 14 | { &hf_q932_subaddressInformation, |
985 | 14 | { "subaddressInformation", "q932.subaddressInformation", |
986 | 14 | FT_BYTES, BASE_NONE, NULL, 0, |
987 | 14 | NULL, HFILL }}, |
988 | 14 | { &hf_q932_oddCountIndicator, |
989 | 14 | { "oddCountIndicator", "q932.oddCountIndicator", |
990 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0, |
991 | 14 | "BOOLEAN", HFILL }}, |
992 | 14 | { &hf_q932_sourceEntity, |
993 | 14 | { "sourceEntity", "q932.sourceEntity", |
994 | 14 | FT_UINT32, BASE_DEC, VALS(q932_EntityType_vals), 0, |
995 | 14 | "EntityType", HFILL }}, |
996 | 14 | { &hf_q932_sourceEntityAddress, |
997 | 14 | { "sourceEntityAddress", "q932.sourceEntityAddress", |
998 | 14 | FT_UINT32, BASE_DEC, VALS(q932_PartyNumber_vals), 0, |
999 | 14 | "AddressInformation", HFILL }}, |
1000 | 14 | { &hf_q932_destinationEntity, |
1001 | 14 | { "destinationEntity", "q932.destinationEntity", |
1002 | 14 | FT_UINT32, BASE_DEC, VALS(q932_EntityType_vals), 0, |
1003 | 14 | "EntityType", HFILL }}, |
1004 | 14 | { &hf_q932_destinationEntityAddress, |
1005 | 14 | { "destinationEntityAddress", "q932.destinationEntityAddress", |
1006 | 14 | FT_UINT32, BASE_DEC, VALS(q932_PartyNumber_vals), 0, |
1007 | 14 | "AddressInformation", HFILL }}, |
1008 | 14 | }; |
1009 | | |
1010 | | /* List of subtrees */ |
1011 | 14 | static int *ett[] = { |
1012 | 14 | &ett_q932, |
1013 | 14 | &ett_q932_ie, |
1014 | 14 | &ett_q932_PresentedAddressScreened, |
1015 | 14 | &ett_q932_PresentedAddressUnscreened, |
1016 | 14 | &ett_q932_PresentedNumberScreened, |
1017 | 14 | &ett_q932_PresentedNumberUnscreened, |
1018 | 14 | &ett_q932_AddressScreened, |
1019 | 14 | &ett_q932_NumberScreened, |
1020 | 14 | &ett_q932_Address, |
1021 | 14 | &ett_q932_PartyNumber, |
1022 | 14 | &ett_q932_PublicPartyNumber, |
1023 | 14 | &ett_q932_PrivatePartyNumber, |
1024 | 14 | &ett_q932_PartySubaddress, |
1025 | 14 | &ett_q932_UserSpecifiedSubaddress, |
1026 | 14 | &ett_q932_NetworkFacilityExtension_U, |
1027 | 14 | }; |
1028 | | |
1029 | 14 | static ei_register_info ei[] = { |
1030 | 14 | { &ei_q932_dse_not_supported, { "q932.dse_not_supported", PI_UNDECODED, PI_WARN, "DSE APDU (not supported)", EXPFILL }}, |
1031 | 14 | { &ei_q932_acse_not_supported, { "q932.acse_not_supported", PI_UNDECODED, PI_WARN, "ACSE APDU (not supported)", EXPFILL }}, |
1032 | 14 | { &ei_q932_unknown_component, { "q932.unknown_component", PI_UNDECODED, PI_WARN, "Unknown Component", EXPFILL }}, |
1033 | 14 | { &ei_q932_asn1_encoded, { "q932.asn1_encoded", PI_UNDECODED, PI_WARN, "ASN.1 Encoded Data Structure(NOT IMPLEMENTED)", EXPFILL }}, |
1034 | 14 | }; |
1035 | | |
1036 | 14 | module_t *q932_module; |
1037 | 14 | expert_module_t* expert_q932; |
1038 | | |
1039 | 14 | static const enum_val_t facility_encoding[] = { |
1040 | 14 | {"QSIG", "Dissect facility as QSIG", FACILITY_QSIG}, |
1041 | 14 | {"ETSI", "Dissect facility as ETSI", FACILITY_ETSI}, |
1042 | 14 | {NULL, NULL, -1} |
1043 | 14 | }; |
1044 | | |
1045 | | /* Register protocol and dissector */ |
1046 | 14 | proto_q932 = proto_register_protocol(PNAME, PSNAME, PFNAME); |
1047 | 14 | register_dissector("q932.apdu", dissect_q932_apdu, proto_q932); |
1048 | 14 | q932_ie_handle = register_dissector("q932.ie", dissect_q932_ie, proto_q932); |
1049 | | |
1050 | | /* Register fields and subtrees */ |
1051 | 14 | proto_register_field_array(proto_q932, hf, array_length(hf)); |
1052 | 14 | proto_register_subtree_array(ett, array_length(ett)); |
1053 | 14 | expert_q932 = expert_register_protocol(proto_q932); |
1054 | 14 | expert_register_field_array(expert_q932, ei, array_length(ei)); |
1055 | | |
1056 | 14 | rose_ctx_init(&q932_rose_ctx); |
1057 | | |
1058 | | /* Register dissector tables */ |
1059 | 14 | q932_rose_ctx.arg_global_dissector_table = register_dissector_table("q932.ros.global.arg", "Q.932 Operation Argument (global opcode)", proto_q932, FT_STRING, STRING_CASE_SENSITIVE); |
1060 | 14 | q932_rose_ctx.res_global_dissector_table = register_dissector_table("q932.ros.global.res", "Q.932 Operation Result (global opcode)", proto_q932, FT_STRING, STRING_CASE_SENSITIVE); |
1061 | 14 | q932_rose_ctx.err_global_dissector_table = register_dissector_table("q932.ros.global.err", "Q.932 Error (global opcode)", proto_q932, FT_STRING, STRING_CASE_SENSITIVE); |
1062 | | |
1063 | 14 | qsig_arg_local_dissector_table = register_dissector_table("q932.ros.local.arg", "Q.932 Operation Argument (local opcode)", proto_q932, FT_UINT32, BASE_HEX); |
1064 | 14 | qsig_res_local_dissector_table = register_dissector_table("q932.ros.local.res", "Q.932 Operation Result (local opcode)", proto_q932, FT_UINT32, BASE_HEX); |
1065 | 14 | qsig_err_local_dissector_table = register_dissector_table("q932.ros.local.err", "Q.932 Error (local opcode)", proto_q932, FT_UINT32, BASE_HEX); |
1066 | | |
1067 | 14 | etsi_arg_local_dissector_table = register_dissector_table("q932.ros.etsi.local.arg", "Q.932 ETSI Operation Argument (local opcode)", proto_q932, FT_UINT32, BASE_HEX); |
1068 | 14 | etsi_res_local_dissector_table = register_dissector_table("q932.ros.etsi.local.res", "Q.932 ETSI Operation Result (local opcode)", proto_q932, FT_UINT32, BASE_HEX); |
1069 | 14 | etsi_err_local_dissector_table = register_dissector_table("q932.ros.etsi.local.err", "Q.932 ETSI Error (local opcode)", proto_q932, FT_UINT32, BASE_HEX); |
1070 | | |
1071 | 14 | q932_module = prefs_register_protocol(proto_q932, proto_reg_handoff_q932); |
1072 | | |
1073 | 14 | prefs_register_enum_preference(q932_module, "facility_encoding", |
1074 | 14 | "Type of Facility encoding", |
1075 | 14 | "Type of Facility encoding", |
1076 | 14 | &g_facility_encoding, facility_encoding, false); |
1077 | 14 | } |
1078 | | |
1079 | | /*--- proto_reg_handoff_q932 ------------------------------------------------*/ |
1080 | 14 | void proto_reg_handoff_q932(void) { |
1081 | 14 | static bool q931_prefs_initialized = false; |
1082 | | |
1083 | 14 | if (!q931_prefs_initialized) { |
1084 | | /* Facility */ |
1085 | 14 | dissector_add_uint("q931.ie", (0x00 << 8) | Q932_IE_FACILITY, q932_ie_handle); |
1086 | | /* Notification indicator */ |
1087 | 14 | dissector_add_uint("q931.ie", (0x00 << 8) | Q932_IE_NOTIFICATION_INDICATOR, q932_ie_handle); |
1088 | 14 | q932_ros_handle = find_dissector_add_dependency("q932.ros", proto_q932); |
1089 | | |
1090 | 14 | q931_prefs_initialized = true; |
1091 | 14 | } |
1092 | | |
1093 | 14 | if(g_facility_encoding == FACILITY_QSIG){ |
1094 | 14 | q932_rose_ctx.arg_local_dissector_table = qsig_arg_local_dissector_table; |
1095 | 14 | q932_rose_ctx.res_local_dissector_table = qsig_res_local_dissector_table; |
1096 | 14 | q932_rose_ctx.err_local_dissector_table = qsig_err_local_dissector_table; |
1097 | 14 | }else{ |
1098 | 0 | q932_rose_ctx.arg_local_dissector_table = etsi_arg_local_dissector_table; |
1099 | 0 | q932_rose_ctx.res_local_dissector_table = etsi_res_local_dissector_table; |
1100 | 0 | q932_rose_ctx.err_local_dissector_table = etsi_err_local_dissector_table; |
1101 | 0 | } |
1102 | | |
1103 | 14 | } |
1104 | | |
1105 | | /*---------------------------------------------------------------------------*/ |