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