Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-q932.c
blob23d79b45976cdffe0f8555e2d7c49019173ac39d
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 */
6 /* packet-q932.c
7 * Routines for Q.932 packet dissection
8 * 2007 Tomas Kukosa
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald@wireshark.org>
12 * Copyright 1998 Gerald Combs
14 * SPDX-License-Identifier: GPL-2.0-or-later
17 #include "config.h"
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>
26 #include "packet-ber.h"
27 #include "packet-q932.h"
29 #define PNAME "Q.932"
30 #define PSNAME "Q932"
31 #define PFNAME "q932"
33 void proto_register_q932(void);
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 */
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;
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;
103 /* Preferences */
105 /* ROSE context */
106 static rose_ctx_t q932_rose_ctx;
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;
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;
116 #define FACILITY_QSIG 0
117 #define FACILITY_ETSI 1
118 static int g_facility_encoding = FACILITY_QSIG;
120 void proto_reg_handoff_q932(void);
122 static dissector_handle_t q932_ie_handle;
124 /* Subdissectors */
125 static dissector_handle_t q932_ros_handle;
127 #define Q932_IE_EXTENDED_FACILITY 0x0D
128 #define Q932_IE_FACILITY 0x1C
129 #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}
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}
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}
189 static int
190 dissect_q932_NumberDigits(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
191 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_NumericString,
192 actx, tree, tvb, offset, hf_index,
193 NULL);
195 return offset;
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 }
210 static int
211 dissect_q932_PublicTypeOfNumber(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
212 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
213 NULL);
215 return offset;
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 }
225 static int
226 dissect_q932_PublicPartyNumber(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
227 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
228 PublicPartyNumber_sequence, hf_index, ett_q932_PublicPartyNumber);
230 return offset;
235 static int
236 dissect_q932_NsapEncodedNumber(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
237 offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
238 NULL);
240 return offset;
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 }
255 static int
256 dissect_q932_PrivateTypeOfNumber(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
257 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
258 NULL);
260 return offset;
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 }
270 static int
271 dissect_q932_PrivatePartyNumber(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
272 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
273 PrivatePartyNumber_sequence, hf_index, ett_q932_PrivatePartyNumber);
275 return offset;
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 }
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 }
302 dissect_q932_PartyNumber(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
303 offset = dissect_ber_choice(actx, tree, tvb, offset,
304 PartyNumber_choice, hf_index, ett_q932_PartyNumber,
305 NULL);
307 return offset;
311 const value_string q932_ScreeningIndicator_vals[] = {
312 { 0, "userProvidedNotScreened" },
313 { 1, "userProvidedVerifiedAndPassed" },
314 { 2, "userProvidedVerifiedAndFailed" },
315 { 3, "networkProvided" },
316 { 0, NULL }
321 dissect_q932_ScreeningIndicator(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
322 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
323 NULL);
325 return offset;
330 static int
331 dissect_q932_SubaddressInformation(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
332 offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
333 NULL);
335 return offset;
340 static int
341 dissect_q932_BOOLEAN(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
342 offset = dissect_ber_boolean(implicit_tag, actx, tree, tvb, offset, hf_index, NULL);
344 return offset;
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 }
354 static int
355 dissect_q932_UserSpecifiedSubaddress(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
356 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
357 UserSpecifiedSubaddress_sequence, hf_index, ett_q932_UserSpecifiedSubaddress);
359 return offset;
364 static int
365 dissect_q932_NSAPSubaddress(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
366 offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
367 NULL);
369 return offset;
373 const value_string q932_PartySubaddress_vals[] = {
374 { 0, "userSpecifiedSubaddress" },
375 { 1, "nSAPSubaddress" },
376 { 0, NULL }
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 }
386 dissect_q932_PartySubaddress(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
387 offset = dissect_ber_choice(actx, tree, tvb, offset,
388 PartySubaddress_choice, hf_index, ett_q932_PartySubaddress,
389 NULL);
391 return offset;
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 }
402 static int
403 dissect_q932_AddressScreened(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
404 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
405 AddressScreened_sequence, hf_index, ett_q932_AddressScreened);
407 return offset;
412 static int
413 dissect_q932_NULL(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
414 offset = dissect_ber_null(implicit_tag, actx, tree, tvb, offset, hf_index);
416 return offset;
420 const value_string q932_PresentedAddressScreened_vals[] = {
421 { 0, "presentationAlIowedAddress" },
422 { 1, "presentationRestricted" },
423 { 2, "numberNotAvailableDueTolnterworking" },
424 { 3, "presentationRestrictedAddress" },
425 { 0, NULL }
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 }
437 dissect_q932_PresentedAddressScreened(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
438 offset = dissect_ber_choice(actx, tree, tvb, offset,
439 PresentedAddressScreened_choice, hf_index, ett_q932_PresentedAddressScreened,
440 NULL);
442 return offset;
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 }
453 dissect_q932_Address(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
454 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
455 Address_sequence, hf_index, ett_q932_Address);
457 return offset;
461 const value_string q932_PresentedAddressUnscreened_vals[] = {
462 { 0, "presentationAllowedAddress" },
463 { 1, "presentationRestricted" },
464 { 2, "numberNotAvailableDueTolnterworking" },
465 { 3, "presentationRestrictedAddress" },
466 { 0, NULL }
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 }
478 dissect_q932_PresentedAddressUnscreened(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
479 offset = dissect_ber_choice(actx, tree, tvb, offset,
480 PresentedAddressUnscreened_choice, hf_index, ett_q932_PresentedAddressUnscreened,
481 NULL);
483 return offset;
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 }
493 static int
494 dissect_q932_NumberScreened(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
495 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
496 NumberScreened_sequence, hf_index, ett_q932_NumberScreened);
498 return offset;
502 const value_string q932_PresentedNumberScreened_vals[] = {
503 { 0, "presentationAllowedNumber" },
504 { 1, "presentationRestricted" },
505 { 2, "numberNotAvailableDueToInterworking" },
506 { 3, "presentationRestrictedNumber" },
507 { 0, NULL }
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 }
519 dissect_q932_PresentedNumberScreened(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
520 offset = dissect_ber_choice(actx, tree, tvb, offset,
521 PresentedNumberScreened_choice, hf_index, ett_q932_PresentedNumberScreened,
522 NULL);
524 return offset;
528 const value_string q932_PresentedNumberUnscreened_vals[] = {
529 { 0, "presentationAllowedNumber" },
530 { 1, "presentationRestricted" },
531 { 2, "numberNotAvailableDueToInterworking" },
532 { 3, "presentationRestrictedNumber" },
533 { 0, NULL }
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 }
545 dissect_q932_PresentedNumberUnscreened(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
546 offset = dissect_ber_choice(actx, tree, tvb, offset,
547 PresentedNumberUnscreened_choice, hf_index, ett_q932_PresentedNumberUnscreened,
548 NULL);
550 return offset;
556 dissect_q932_PresentationAllowedIndicator(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
557 offset = dissect_ber_boolean(implicit_tag, actx, tree, tvb, offset, hf_index, NULL);
559 return offset;
563 static const value_string q932_EntityType_vals[] = {
564 { 0, "endPINX" },
565 { 1, "anyTypeOfPINX" },
566 { 0, NULL }
570 static int
571 dissect_q932_EntityType(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
572 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
573 NULL);
575 return offset;
580 static int
581 dissect_q932_AddressInformation(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
582 offset = dissect_q932_PartyNumber(implicit_tag, tvb, offset, actx, tree, hf_index);
584 return offset;
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 }
596 static int
597 dissect_q932_NetworkFacilityExtension_U(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
598 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
599 NetworkFacilityExtension_U_sequence, hf_index, ett_q932_NetworkFacilityExtension_U);
601 return offset;
606 static int
607 dissect_q932_NetworkFacilityExtension(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
608 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
609 hf_index, BER_CLASS_CON, 10, true, dissect_q932_NetworkFacilityExtension_U);
611 return offset;
615 static const value_string q932_NetworkProtocolProfile_U_vals[] = {
616 { 19, "acse" },
617 { 32, "dse" },
618 { 0, NULL }
622 static int
623 dissect_q932_NetworkProtocolProfile_U(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
624 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
625 NULL);
627 return offset;
632 static int
633 dissect_q932_NetworkProtocolProfile(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
634 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
635 hf_index, BER_CLASS_CON, 18, true, dissect_q932_NetworkProtocolProfile_U);
637 return offset;
641 static const value_string q932_InterpretationComponent_U_vals[] = {
642 { 0, "discardAnyUnrecognisedInvokePdu" },
643 { 1, "clearCallIfAnyInvokePduNotRecognised" },
644 { 2, "rejectAnyUnrecognisedInvokePdu" },
645 { 0, NULL }
649 static int
650 dissect_q932_InterpretationComponent_U(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
651 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
652 NULL);
654 return offset;
659 static int
660 dissect_q932_InterpretationComponent(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
661 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
662 hf_index, BER_CLASS_CON, 11, true, dissect_q932_InterpretationComponent_U);
664 return offset;
667 /*--- PDUs ---*/
669 static int dissect_NetworkFacilityExtension_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
670 int offset = 0;
671 asn1_ctx_t asn1_ctx;
672 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
673 offset = dissect_q932_NetworkFacilityExtension(false, tvb, offset, &asn1_ctx, tree, hf_q932_NetworkFacilityExtension_PDU);
674 return offset;
676 static int dissect_NetworkProtocolProfile_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
677 int offset = 0;
678 asn1_ctx_t asn1_ctx;
679 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
680 offset = dissect_q932_NetworkProtocolProfile(false, tvb, offset, &asn1_ctx, tree, hf_q932_NetworkProtocolProfile_PDU);
681 return offset;
683 static int dissect_InterpretationComponent_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
684 int offset = 0;
685 asn1_ctx_t asn1_ctx;
686 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
687 offset = dissect_q932_InterpretationComponent(false, tvb, offset, &asn1_ctx, tree, hf_q932_InterpretationComponent_PDU);
688 return offset;
692 /*--- dissect_q932_facility_ie -------------------------------------------------------*/
693 static void
694 dissect_q932_facility_ie(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int length) {
695 int8_t appclass;
696 bool pc;
697 int32_t tag;
698 uint32_t len;
699 int hoffset, eoffset;
700 int ie_end;
701 tvbuff_t *next_tvb;
703 ie_end = offset + length;
704 proto_tree_add_item(tree, hf_q932_pp, tvb, offset, 1, ENC_BIG_ENDIAN);
705 offset++;
706 while (offset < ie_end) {
707 hoffset = offset;
708 offset = get_ber_identifier(tvb, offset, &appclass, &pc, &tag);
709 offset = get_ber_length(tvb, offset, &len, NULL);
710 eoffset = offset + len;
711 next_tvb = tvb_new_subset_length(tvb, hoffset, eoffset - hoffset);
712 switch (appclass) {
713 case BER_CLASS_CON:
714 switch (tag) {
715 case 10 : /* Network Facility Extension */
716 dissect_NetworkFacilityExtension_PDU(next_tvb, pinfo, tree, NULL);
717 break;
718 case 18 : /* Network Protocol Profile */
719 dissect_NetworkProtocolProfile_PDU(next_tvb, pinfo, tree, NULL);
720 break;
721 case 11 : /* Interpretation Component */
722 dissect_InterpretationComponent_PDU(next_tvb, pinfo, tree, NULL);
723 break;
724 /* ROSE APDU */
725 case 1 : /* invoke */
726 case 2 : /* returnResult */
727 case 3 : /* returnError */
728 case 4 : /* reject */
729 q932_rose_ctx.apdu_depth = 1;
730 call_dissector_with_data(q932_ros_handle, next_tvb, pinfo, tree, &q932_rose_ctx);
731 break;
732 /* DSE APDU */
733 case 12 : /* begin */
734 case 14 : /* end */
735 case 15 : /* continue */
736 case 17 : /* abort */
737 offset = dissect_ber_identifier(pinfo, tree, tvb, hoffset, NULL, NULL, NULL);
738 offset = dissect_ber_length(pinfo, tree, tvb, offset, NULL, NULL);
739 proto_tree_add_expert(tree, pinfo, &ei_q932_dse_not_supported, tvb, offset, len);
740 break;
741 default:
742 offset = dissect_ber_identifier(pinfo, tree, tvb, hoffset, NULL, NULL, NULL);
743 offset = dissect_ber_length(pinfo, tree, tvb, offset, NULL, NULL);
744 proto_tree_add_expert(tree, pinfo, &ei_q932_unknown_component, tvb, offset, len);
746 break;
747 case BER_CLASS_APP:
748 switch (tag) {
749 /* ACSE APDU */
750 case 0 : /* aarq */
751 case 1 : /* aare */
752 case 2 : /* rlrq */
753 case 3 : /* rlre */
754 case 4 : /* abrt */
755 offset = dissect_ber_identifier(pinfo, tree, tvb, hoffset, NULL, NULL, NULL);
756 offset = dissect_ber_length(pinfo, tree, tvb, offset, NULL, NULL);
757 proto_tree_add_expert(tree, pinfo, &ei_q932_acse_not_supported, tvb, offset, len);
758 break;
759 default:
760 offset = dissect_ber_identifier(pinfo, tree, tvb, hoffset, NULL, NULL, NULL);
761 offset = dissect_ber_length(pinfo, tree, tvb, offset, NULL, NULL);
762 proto_tree_add_expert(tree, pinfo, &ei_q932_unknown_component, tvb, offset, len);
764 break;
765 default:
766 offset = dissect_ber_identifier(pinfo, tree, tvb, hoffset, NULL, NULL, NULL);
767 offset = dissect_ber_length(pinfo, tree, tvb, offset, NULL, NULL);
768 proto_tree_add_expert(tree, pinfo, &ei_q932_unknown_component, tvb, offset, len);
770 offset = eoffset;
774 /*--- dissect_q932_ni_ie -------------------------------------------------------*/
775 static void
776 dissect_q932_ni_ie(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int length) {
777 int remain = length;
778 uint8_t octet = 0;
779 uint32_t value = 0;
780 proto_item* ti;
782 while ((remain > 0) && !(octet & 0x80)) {
783 octet = tvb_get_uint8(tvb, offset++);
784 remain--;
785 value <<= 7;
786 value |= octet & 0x7F;
788 ti = proto_tree_add_uint(tree, hf_q932_nd, tvb, offset - (length - remain), length - remain, value);
790 if (remain > 0) {
791 expert_add_info(pinfo, ti, &ei_q932_asn1_encoded);
795 /*--- dissect_q932_ie -------------------------------------------------------*/
796 static int
797 dissect_q932_ie(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) {
798 int offset;
799 proto_item *ti;
800 proto_tree *ie_tree;
801 uint8_t ie_type, ie_len;
803 offset = 0;
805 ti = proto_tree_add_item(tree, proto_q932, tvb, offset, -1, ENC_NA);
806 proto_item_set_hidden(ti);
808 ie_type = tvb_get_uint8(tvb, offset);
809 ie_len = tvb_get_uint8(tvb, offset + 1);
811 ie_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_q932_ie, NULL,
812 val_to_str(ie_type, VALS(q932_str_ie_type), "unknown (0x%02X)"));
814 proto_tree_add_item(ie_tree, hf_q932_ie_type, tvb, offset, 1, ENC_BIG_ENDIAN);
815 proto_tree_add_item(ie_tree, hf_q932_ie_len, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
816 offset += 2;
817 if (tvb_reported_length_remaining(tvb, offset) <= 0)
818 return offset;
819 switch (ie_type) {
820 case Q932_IE_FACILITY :
821 dissect_q932_facility_ie(tvb, offset, pinfo, ie_tree, ie_len);
822 break;
823 case Q932_IE_NOTIFICATION_INDICATOR :
824 dissect_q932_ni_ie(tvb, offset, pinfo, ie_tree, ie_len);
825 break;
826 default:
827 if (ie_len > 0) {
828 proto_tree_add_item(ie_tree, hf_q932_ie_data, tvb, offset, ie_len, ENC_NA);
831 return tvb_captured_length(tvb);
834 /*--- dissect_q932_apdu -----------------------------------------------------*/
835 static int
836 dissect_q932_apdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) {
837 return call_dissector(q932_ros_handle, tvb, pinfo, tree);
840 /*--- proto_register_q932 ---------------------------------------------------*/
841 void proto_register_q932(void) {
843 /* List of fields */
844 static hf_register_info hf[] = {
845 { &hf_q932_ie_type, { "Type", "q932.ie.type",
846 FT_UINT8, BASE_HEX, VALS(q932_str_ie_type), 0x0,
847 "Information Element Type", HFILL }},
848 { &hf_q932_ie_len, { "Length", "q932.ie.len",
849 FT_UINT8, BASE_DEC, NULL, 0x0,
850 "Information Element Length", HFILL }},
851 { &hf_q932_ie_data, { "Data", "q932.ie.data",
852 FT_BYTES, BASE_NONE, NULL, 0x0,
853 NULL, HFILL }},
854 { &hf_q932_pp, { "Protocol profile", "q932.pp",
855 FT_UINT8, BASE_HEX, VALS(str_pp), 0x1F,
856 NULL, HFILL }},
857 { &hf_q932_nd, { "Notification description", "q932.nd",
858 FT_UINT8, BASE_HEX, VALS(str_nd), 0x0,
859 NULL, HFILL }},
860 { &hf_q932_NetworkFacilityExtension_PDU,
861 { "NetworkFacilityExtension", "q932.NetworkFacilityExtension_element",
862 FT_NONE, BASE_NONE, NULL, 0,
863 NULL, HFILL }},
864 { &hf_q932_NetworkProtocolProfile_PDU,
865 { "NetworkProtocolProfile", "q932.NetworkProtocolProfile",
866 FT_UINT32, BASE_DEC, VALS(q932_NetworkProtocolProfile_U_vals), 0,
867 NULL, HFILL }},
868 { &hf_q932_InterpretationComponent_PDU,
869 { "InterpretationComponent", "q932.InterpretationComponent",
870 FT_UINT32, BASE_DEC, VALS(q932_InterpretationComponent_U_vals), 0,
871 NULL, HFILL }},
872 { &hf_q932_presentationAlIowedAddress,
873 { "presentationAlIowedAddress", "q932.presentationAlIowedAddress_element",
874 FT_NONE, BASE_NONE, NULL, 0,
875 "AddressScreened", HFILL }},
876 { &hf_q932_presentationRestricted,
877 { "presentationRestricted", "q932.presentationRestricted_element",
878 FT_NONE, BASE_NONE, NULL, 0,
879 NULL, HFILL }},
880 { &hf_q932_numberNotAvailableDueTolnterworking,
881 { "numberNotAvailableDueTolnterworking", "q932.numberNotAvailableDueTolnterworking_element",
882 FT_NONE, BASE_NONE, NULL, 0,
883 NULL, HFILL }},
884 { &hf_q932_presentationRestrictedAddressScreened,
885 { "presentationRestrictedAddress", "q932.presentationRestrictedAddressScreened_element",
886 FT_NONE, BASE_NONE, NULL, 0,
887 "AddressScreened", HFILL }},
888 { &hf_q932_presentationAllowedAddress,
889 { "presentationAllowedAddress", "q932.presentationAllowedAddress_element",
890 FT_NONE, BASE_NONE, NULL, 0,
891 "Address", HFILL }},
892 { &hf_q932_presentationRestrictedAddress,
893 { "presentationRestrictedAddress", "q932.presentationRestrictedAddress_element",
894 FT_NONE, BASE_NONE, NULL, 0,
895 "Address", HFILL }},
896 { &hf_q932_presentationAllowedNumberScreened,
897 { "presentationAllowedNumber", "q932.presentationAllowedNumberScreened_element",
898 FT_NONE, BASE_NONE, NULL, 0,
899 "NumberScreened", HFILL }},
900 { &hf_q932_numberNotAvailableDueToInterworking,
901 { "numberNotAvailableDueToInterworking", "q932.numberNotAvailableDueToInterworking_element",
902 FT_NONE, BASE_NONE, NULL, 0,
903 NULL, HFILL }},
904 { &hf_q932_presentationRestrictedNumberScreened,
905 { "presentationRestrictedNumber", "q932.presentationRestrictedNumberScreened_element",
906 FT_NONE, BASE_NONE, NULL, 0,
907 "NumberScreened", HFILL }},
908 { &hf_q932_presentationAllowedNumber,
909 { "presentationAllowedNumber", "q932.presentationAllowedNumber",
910 FT_UINT32, BASE_DEC, VALS(q932_PartyNumber_vals), 0,
911 "PartyNumber", HFILL }},
912 { &hf_q932_presentationRestrictedNumber,
913 { "presentationRestrictedNumber", "q932.presentationRestrictedNumber",
914 FT_UINT32, BASE_DEC, VALS(q932_PartyNumber_vals), 0,
915 "PartyNumber", HFILL }},
916 { &hf_q932_partyNumber,
917 { "partyNumber", "q932.partyNumber",
918 FT_UINT32, BASE_DEC, VALS(q932_PartyNumber_vals), 0,
919 NULL, HFILL }},
920 { &hf_q932_screeninglndicator,
921 { "screeninglndicator", "q932.screeninglndicator",
922 FT_UINT32, BASE_DEC, VALS(q932_ScreeningIndicator_vals), 0,
923 "ScreeningIndicator", HFILL }},
924 { &hf_q932_partySubaddress,
925 { "partySubaddress", "q932.partySubaddress",
926 FT_UINT32, BASE_DEC, VALS(q932_PartySubaddress_vals), 0,
927 NULL, HFILL }},
928 { &hf_q932_screeningIndicator,
929 { "screeningIndicator", "q932.screeningIndicator",
930 FT_UINT32, BASE_DEC, VALS(q932_ScreeningIndicator_vals), 0,
931 NULL, HFILL }},
932 { &hf_q932_unknownPartyNumber,
933 { "unknownPartyNumber", "q932.unknownPartyNumber",
934 FT_STRING, BASE_NONE, NULL, 0,
935 "NumberDigits", HFILL }},
936 { &hf_q932_publicPartyNumber,
937 { "publicPartyNumber", "q932.publicPartyNumber_element",
938 FT_NONE, BASE_NONE, NULL, 0,
939 NULL, HFILL }},
940 { &hf_q932_nsapEncodedNumber,
941 { "nsapEncodedNumber", "q932.nsapEncodedNumber",
942 FT_BYTES, BASE_NONE, NULL, 0,
943 NULL, HFILL }},
944 { &hf_q932_dataPartyNumber,
945 { "dataPartyNumber", "q932.dataPartyNumber",
946 FT_STRING, BASE_NONE, NULL, 0,
947 "NumberDigits", HFILL }},
948 { &hf_q932_telexPartyNumber,
949 { "telexPartyNumber", "q932.telexPartyNumber",
950 FT_STRING, BASE_NONE, NULL, 0,
951 "NumberDigits", HFILL }},
952 { &hf_q932_privatePartyNumber,
953 { "privatePartyNumber", "q932.privatePartyNumber_element",
954 FT_NONE, BASE_NONE, NULL, 0,
955 NULL, HFILL }},
956 { &hf_q932_nationalStandardPartyNumber,
957 { "nationalStandardPartyNumber", "q932.nationalStandardPartyNumber",
958 FT_STRING, BASE_NONE, NULL, 0,
959 "NumberDigits", HFILL }},
960 { &hf_q932_publicTypeOfNumber,
961 { "publicTypeOfNumber", "q932.publicTypeOfNumber",
962 FT_UINT32, BASE_DEC, VALS(q932_PublicTypeOfNumber_vals), 0,
963 NULL, HFILL }},
964 { &hf_q932_publicNumberDigits,
965 { "publicNumberDigits", "q932.publicNumberDigits",
966 FT_STRING, BASE_NONE, NULL, 0,
967 "NumberDigits", HFILL }},
968 { &hf_q932_privateTypeOfNumber,
969 { "privateTypeOfNumber", "q932.privateTypeOfNumber",
970 FT_UINT32, BASE_DEC, VALS(q932_PrivateTypeOfNumber_vals), 0,
971 NULL, HFILL }},
972 { &hf_q932_privateNumberDigits,
973 { "privateNumberDigits", "q932.privateNumberDigits",
974 FT_STRING, BASE_NONE, NULL, 0,
975 "NumberDigits", HFILL }},
976 { &hf_q932_userSpecifiedSubaddress,
977 { "userSpecifiedSubaddress", "q932.userSpecifiedSubaddress_element",
978 FT_NONE, BASE_NONE, NULL, 0,
979 NULL, HFILL }},
980 { &hf_q932_nSAPSubaddress,
981 { "nSAPSubaddress", "q932.nSAPSubaddress",
982 FT_BYTES, BASE_NONE, NULL, 0,
983 NULL, HFILL }},
984 { &hf_q932_subaddressInformation,
985 { "subaddressInformation", "q932.subaddressInformation",
986 FT_BYTES, BASE_NONE, NULL, 0,
987 NULL, HFILL }},
988 { &hf_q932_oddCountIndicator,
989 { "oddCountIndicator", "q932.oddCountIndicator",
990 FT_BOOLEAN, BASE_NONE, NULL, 0,
991 "BOOLEAN", HFILL }},
992 { &hf_q932_sourceEntity,
993 { "sourceEntity", "q932.sourceEntity",
994 FT_UINT32, BASE_DEC, VALS(q932_EntityType_vals), 0,
995 "EntityType", HFILL }},
996 { &hf_q932_sourceEntityAddress,
997 { "sourceEntityAddress", "q932.sourceEntityAddress",
998 FT_UINT32, BASE_DEC, VALS(q932_PartyNumber_vals), 0,
999 "AddressInformation", HFILL }},
1000 { &hf_q932_destinationEntity,
1001 { "destinationEntity", "q932.destinationEntity",
1002 FT_UINT32, BASE_DEC, VALS(q932_EntityType_vals), 0,
1003 "EntityType", HFILL }},
1004 { &hf_q932_destinationEntityAddress,
1005 { "destinationEntityAddress", "q932.destinationEntityAddress",
1006 FT_UINT32, BASE_DEC, VALS(q932_PartyNumber_vals), 0,
1007 "AddressInformation", HFILL }},
1010 /* List of subtrees */
1011 static int *ett[] = {
1012 &ett_q932,
1013 &ett_q932_ie,
1014 &ett_q932_PresentedAddressScreened,
1015 &ett_q932_PresentedAddressUnscreened,
1016 &ett_q932_PresentedNumberScreened,
1017 &ett_q932_PresentedNumberUnscreened,
1018 &ett_q932_AddressScreened,
1019 &ett_q932_NumberScreened,
1020 &ett_q932_Address,
1021 &ett_q932_PartyNumber,
1022 &ett_q932_PublicPartyNumber,
1023 &ett_q932_PrivatePartyNumber,
1024 &ett_q932_PartySubaddress,
1025 &ett_q932_UserSpecifiedSubaddress,
1026 &ett_q932_NetworkFacilityExtension_U,
1029 static ei_register_info ei[] = {
1030 { &ei_q932_dse_not_supported, { "q932.dse_not_supported", PI_UNDECODED, PI_WARN, "DSE APDU (not supported)", EXPFILL }},
1031 { &ei_q932_acse_not_supported, { "q932.acse_not_supported", PI_UNDECODED, PI_WARN, "ACSE APDU (not supported)", EXPFILL }},
1032 { &ei_q932_unknown_component, { "q932.unknown_component", PI_UNDECODED, PI_WARN, "Unknown Component", EXPFILL }},
1033 { &ei_q932_asn1_encoded, { "q932.asn1_encoded", PI_UNDECODED, PI_WARN, "ASN.1 Encoded Data Structure(NOT IMPLEMENTED)", EXPFILL }},
1036 module_t *q932_module;
1037 expert_module_t* expert_q932;
1039 static const enum_val_t facility_encoding[] = {
1040 {"QSIG", "Dissect facility as QSIG", FACILITY_QSIG},
1041 {"ETSI", "Dissect facility as ETSI", FACILITY_ETSI},
1042 {NULL, NULL, -1}
1045 /* Register protocol and dissector */
1046 proto_q932 = proto_register_protocol(PNAME, PSNAME, PFNAME);
1047 register_dissector("q932.apdu", dissect_q932_apdu, proto_q932);
1048 q932_ie_handle = register_dissector("q932.ie", dissect_q932_ie, proto_q932);
1050 /* Register fields and subtrees */
1051 proto_register_field_array(proto_q932, hf, array_length(hf));
1052 proto_register_subtree_array(ett, array_length(ett));
1053 expert_q932 = expert_register_protocol(proto_q932);
1054 expert_register_field_array(expert_q932, ei, array_length(ei));
1056 rose_ctx_init(&q932_rose_ctx);
1058 /* Register dissector tables */
1059 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 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 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);
1063 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 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 qsig_err_local_dissector_table = register_dissector_table("q932.ros.local.err", "Q.932 Error (local opcode)", proto_q932, FT_UINT32, BASE_HEX);
1067 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 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 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);
1071 q932_module = prefs_register_protocol(proto_q932, proto_reg_handoff_q932);
1073 prefs_register_enum_preference(q932_module, "facility_encoding",
1074 "Type of Facility encoding",
1075 "Type of Facility encoding",
1076 &g_facility_encoding, facility_encoding, false);
1079 /*--- proto_reg_handoff_q932 ------------------------------------------------*/
1080 void proto_reg_handoff_q932(void) {
1081 static bool q931_prefs_initialized = false;
1083 if (!q931_prefs_initialized) {
1084 /* Facility */
1085 dissector_add_uint("q931.ie", (0x00 << 8) | Q932_IE_FACILITY, q932_ie_handle);
1086 /* Notification indicator */
1087 dissector_add_uint("q931.ie", (0x00 << 8) | Q932_IE_NOTIFICATION_INDICATOR, q932_ie_handle);
1088 q932_ros_handle = find_dissector_add_dependency("q932.ros", proto_q932);
1090 q931_prefs_initialized = true;
1093 if(g_facility_encoding == FACILITY_QSIG){
1094 q932_rose_ctx.arg_local_dissector_table = qsig_arg_local_dissector_table;
1095 q932_rose_ctx.res_local_dissector_table = qsig_res_local_dissector_table;
1096 q932_rose_ctx.err_local_dissector_table = qsig_err_local_dissector_table;
1097 }else{
1098 q932_rose_ctx.arg_local_dissector_table = etsi_arg_local_dissector_table;
1099 q932_rose_ctx.res_local_dissector_table = etsi_res_local_dissector_table;
1100 q932_rose_ctx.err_local_dissector_table = etsi_err_local_dissector_table;
1105 /*---------------------------------------------------------------------------*/