- dissect_ber_object_identifier() returns value as tvb
[obnox/wireshark/wip.git] / epan / dissectors / packet-pres.c
1 /* Do not modify this file.                                                   */
2 /* It is created automatically by the ASN.1 to Ethereal dissector compiler    */
3 /* .\packet-pres.c                                                            */
4 /* ../../tools/asn2eth.py -X -b -e -p pres -c pres.cnf -s packet-pres-template ISO8823-PRESENTATION.asn */
5
6 /* Input file: packet-pres-template.c */
7
8 /* packet-pres.c
9  * Routine to dissect ISO 8823 OSI Presentation Protocol packets
10  * Based on the dissector by 
11  * Yuriy Sidelnikov <YSidelnikov@hotmail.com>
12  *
13  * $Id$
14  *
15  * Ethereal - Network traffic analyzer
16  * By Gerald Combs <gerald@ethereal.com>
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 <glib.h>
39 #include <epan/packet.h>
40 #include <epan/conversation.h>
41 #include <epan/emem.h>
42
43 #include <stdio.h>
44 #include <string.h>
45
46 #include "packet-ber.h"
47 #include "packet-ses.h"
48 #include "packet-pres.h"
49 #include "packet-rtse.h"
50
51
52 #define PNAME  "ISO 8823 OSI Presentation Protocol"
53 #define PSNAME "PRES"
54 #define PFNAME "pres"
55
56 /* Initialize the protocol and registered fields */
57 int proto_pres = -1;
58 /*   type of session envelop */
59 static struct SESSION_DATA_STRUCTURE* session = NULL;
60
61 /*      pointers for acse dissector  */
62 proto_tree *global_tree  = NULL;
63 packet_info *global_pinfo = NULL;
64
65 /* dissector for data */
66 static dissector_handle_t data_handle;
67
68 static const char *abstract_syntax_name_oid;
69 static guint32 presentation_context_identifier;
70
71 /* to keep track of presentation context identifiers and protocol-oids */
72 typedef struct _pres_ctx_oid_t {
73         /* XXX here we should keep track of ADDRESS/PORT as well */
74         guint32 ctx_id;
75         char *oid;
76 } pres_ctx_oid_t;
77 static GHashTable *pres_ctx_oid_table = NULL;
78
79 static int hf_pres_CP_type = -1;
80 static int hf_pres_CPA_PPDU = -1;
81 static int hf_pres_Abort_type = -1;
82 static int hf_pres_CPR_PPDU = -1;
83 static int hf_pres_Typed_data_type = -1;
84
85
86 /*--- Included file: packet-pres-hf.c ---*/
87
88 static int hf_pres_mode_selector = -1;            /* Mode_selector */
89 static int hf_pres_x410_mode_parameters = -1;     /* RTORQapdu */
90 static int hf_pres_normal_mode_parameters = -1;   /* T_normal_mode_parameters */
91 static int hf_pres_protocol_version = -1;         /* Protocol_version */
92 static int hf_pres_calling_presentation_selector = -1;  /* Calling_presentation_selector */
93 static int hf_pres_called_presentation_selector = -1;  /* Called_presentation_selector */
94 static int hf_pres_presentation_context_definition_list = -1;  /* Presentation_context_definition_list */
95 static int hf_pres_default_context_name = -1;     /* Default_context_name */
96 static int hf_pres_presentation_requirements = -1;  /* Presentation_requirements */
97 static int hf_pres_user_session_requirements = -1;  /* User_session_requirements */
98 static int hf_pres_protocol_options = -1;         /* Protocol_options */
99 static int hf_pres_initiators_nominated_context = -1;  /* Presentation_context_identifier */
100 static int hf_pres_extensions = -1;               /* T_extensions */
101 static int hf_pres_user_data = -1;                /* User_data */
102 static int hf_pres_cPR_PPDU_x400_mode_parameters = -1;  /* RTOACapdu */
103 static int hf_pres_cPU_PPDU_normal_mode_parameters = -1;  /* T_CPA_PPDU_normal_mode_parameters */
104 static int hf_pres_responding_presentation_selector = -1;  /* Responding_presentation_selector */
105 static int hf_pres_presentation_context_definition_result_list = -1;  /* Presentation_context_definition_result_list */
106 static int hf_pres_responders_nominated_context = -1;  /* Presentation_context_identifier */
107 static int hf_pres_cPU_PPDU_x400_mode_parameters = -1;  /* RTORJapdu */
108 static int hf_pres_cPR_PPDU_normal_mode_parameters = -1;  /* T_CPR_PPDU_normal_mode_parameters */
109 static int hf_pres_default_context_result = -1;   /* Default_context_result */
110 static int hf_pres_cPR_PPDU__provider_reason = -1;  /* Provider_reason */
111 static int hf_pres_aru_ppdu = -1;                 /* ARU_PPDU */
112 static int hf_pres_arp_ppdu = -1;                 /* ARP_PPDU */
113 static int hf_pres_aRU_PPDU_x400_mode_parameters = -1;  /* RTABapdu */
114 static int hf_pres_aRU_PPDU_normal_mode_parameters = -1;  /* T_ARU_PPDU_normal_mode_parameters */
115 static int hf_pres_presentation_context_identifier_list = -1;  /* Presentation_context_identifier_list */
116 static int hf_pres_aRU_PPDU_provider_reason = -1;  /* Abort_reason */
117 static int hf_pres_event_identifier = -1;         /* Event_identifier */
118 static int hf_pres_acPPDU = -1;                   /* AC_PPDU */
119 static int hf_pres_acaPPDU = -1;                  /* ACA_PPDU */
120 static int hf_pres_ttdPPDU = -1;                  /* User_data */
121 static int hf_pres_presentation_context_addition_list = -1;  /* Presentation_context_addition_list */
122 static int hf_pres_presentation_context_deletion_list = -1;  /* Presentation_context_deletion_list */
123 static int hf_pres_presentation_context_addition_result_list = -1;  /* Presentation_context_addition_result_list */
124 static int hf_pres_presentation_context_deletion_result_list = -1;  /* Presentation_context_deletion_result_list */
125 static int hf_pres_Context_list_item = -1;        /* Context_list_item */
126 static int hf_pres_presentation_context_identifier = -1;  /* Presentation_context_identifier */
127 static int hf_pres_abstract_syntax_name = -1;     /* Abstract_syntax_name */
128 static int hf_pres_transfer_syntax_name_list = -1;  /* SEQUENCE_OF_Transfer_syntax_name */
129 static int hf_pres_transfer_syntax_name_list_item = -1;  /* Transfer_syntax_name */
130 static int hf_pres_transfer_syntax_name = -1;     /* Transfer_syntax_name */
131 static int hf_pres_mode_value = -1;               /* T_mode_value */
132 static int hf_pres_Presentation_context_deletion_list_item = -1;  /* Presentation_context_identifier */
133 static int hf_pres_Presentation_context_deletion_result_list_item = -1;  /* Presentation_context_deletion_result_list_item */
134 static int hf_pres_Presentation_context_identifier_list_item = -1;  /* Presentation_context_identifier_list_item */
135 static int hf_pres_Result_list_item = -1;         /* Result_list_item */
136 static int hf_pres_result = -1;                   /* Result */
137 static int hf_pres_provider_reason = -1;          /* T_provider_reason */
138 static int hf_pres_simply_encoded_data = -1;      /* Simply_encoded_data */
139 static int hf_pres_fully_encoded_data = -1;       /* Fully_encoded_data */
140 static int hf_pres_Fully_encoded_data_item = -1;  /* PDV_list */
141 static int hf_pres_presentation_data_values = -1;  /* T_presentation_data_values */
142 static int hf_pres_single_ASN1_type = -1;         /* T_single_ASN1_type */
143 static int hf_pres_octet_aligned = -1;            /* T_octet_aligned */
144 static int hf_pres_arbitrary = -1;                /* BIT_STRING */
145 /* named bits */
146 static int hf_pres_Presentation_requirements_context_management = -1;
147 static int hf_pres_Presentation_requirements_restoration = -1;
148 static int hf_pres_Protocol_options_nominated_context = -1;
149 static int hf_pres_Protocol_options_short_encoding = -1;
150 static int hf_pres_Protocol_options_packed_encoding_rules = -1;
151 static int hf_pres_Protocol_version_version_1 = -1;
152 static int hf_pres_User_session_requirements_half_duplex = -1;
153 static int hf_pres_User_session_requirements_duplex = -1;
154 static int hf_pres_User_session_requirements_expedited_data = -1;
155 static int hf_pres_User_session_requirements_minor_synchronize = -1;
156 static int hf_pres_User_session_requirements_major_synchronize = -1;
157 static int hf_pres_User_session_requirements_resynchronize = -1;
158 static int hf_pres_User_session_requirements_activity_management = -1;
159 static int hf_pres_User_session_requirements_negotiated_release = -1;
160 static int hf_pres_User_session_requirements_capability_data = -1;
161 static int hf_pres_User_session_requirements_exceptions = -1;
162 static int hf_pres_User_session_requirements_typed_data = -1;
163 static int hf_pres_User_session_requirements_symmetric_synchronize = -1;
164 static int hf_pres_User_session_requirements_data_separation = -1;
165
166 /*--- End of included file: packet-pres-hf.c ---*/
167
168
169 /* Initialize the subtree pointers */
170 static gint ett_pres           = -1;
171
172
173 /*--- Included file: packet-pres-ett.c ---*/
174
175 static gint ett_pres_CP_type = -1;
176 static gint ett_pres_T_normal_mode_parameters = -1;
177 static gint ett_pres_T_extensions = -1;
178 static gint ett_pres_CPA_PPDU = -1;
179 static gint ett_pres_T_CPA_PPDU_normal_mode_parameters = -1;
180 static gint ett_pres_CPR_PPDU = -1;
181 static gint ett_pres_T_CPR_PPDU_normal_mode_parameters = -1;
182 static gint ett_pres_Abort_type = -1;
183 static gint ett_pres_ARU_PPDU = -1;
184 static gint ett_pres_T_ARU_PPDU_normal_mode_parameters = -1;
185 static gint ett_pres_ARP_PPDU = -1;
186 static gint ett_pres_Typed_data_type = -1;
187 static gint ett_pres_AC_PPDU = -1;
188 static gint ett_pres_ACA_PPDU = -1;
189 static gint ett_pres_RS_PPDU = -1;
190 static gint ett_pres_RSA_PPDU = -1;
191 static gint ett_pres_Context_list = -1;
192 static gint ett_pres_Context_list_item = -1;
193 static gint ett_pres_SEQUENCE_OF_Transfer_syntax_name = -1;
194 static gint ett_pres_Default_context_name = -1;
195 static gint ett_pres_Mode_selector = -1;
196 static gint ett_pres_Presentation_context_deletion_list = -1;
197 static gint ett_pres_Presentation_context_deletion_result_list = -1;
198 static gint ett_pres_Presentation_context_identifier_list = -1;
199 static gint ett_pres_Presentation_context_identifier_list_item = -1;
200 static gint ett_pres_Presentation_requirements = -1;
201 static gint ett_pres_Protocol_options = -1;
202 static gint ett_pres_Protocol_version = -1;
203 static gint ett_pres_Result_list = -1;
204 static gint ett_pres_Result_list_item = -1;
205 static gint ett_pres_User_data = -1;
206 static gint ett_pres_Fully_encoded_data = -1;
207 static gint ett_pres_PDV_list = -1;
208 static gint ett_pres_T_presentation_data_values = -1;
209 static gint ett_pres_User_session_requirements = -1;
210
211 /*--- End of included file: packet-pres-ett.c ---*/
212
213
214
215 static guint
216 pres_ctx_oid_hash(gconstpointer k)
217 {
218         pres_ctx_oid_t *pco=(pres_ctx_oid_t *)k;
219         return pco->ctx_id;
220 }
221 /* XXX this one should be made ADDRESS/PORT aware */
222 static gint
223 pres_ctx_oid_equal(gconstpointer k1, gconstpointer k2)
224 {
225         pres_ctx_oid_t *pco1=(pres_ctx_oid_t *)k1;
226         pres_ctx_oid_t *pco2=(pres_ctx_oid_t *)k2;
227         return pco1->ctx_id==pco2->ctx_id;
228 }
229
230 static void
231 pres_init(void)
232 {
233         if( pres_ctx_oid_table ){
234                 g_hash_table_destroy(pres_ctx_oid_table);
235                 pres_ctx_oid_table = NULL;
236         }
237         pres_ctx_oid_table = g_hash_table_new(pres_ctx_oid_hash,
238                         pres_ctx_oid_equal);
239
240 }
241
242 static void
243 register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, const char *oid)
244 {
245         pres_ctx_oid_t *pco, *tmppco;
246         pco=se_alloc(sizeof(pres_ctx_oid_t));
247         pco->ctx_id=idx;
248         pco->oid=se_strdup(oid);
249
250         /* if this ctx already exists, remove the old one first */
251         tmppco=(pres_ctx_oid_t *)g_hash_table_lookup(pres_ctx_oid_table, pco);
252         if(tmppco){
253                 g_hash_table_remove(pres_ctx_oid_table, tmppco);
254
255         }
256         g_hash_table_insert(pres_ctx_oid_table, pco, pco);
257 }
258 char *
259 find_oid_by_pres_ctx_id(packet_info *pinfo _U_, guint32 idx)
260 {
261         pres_ctx_oid_t pco, *tmppco;
262         pco.ctx_id=idx;
263         tmppco=(pres_ctx_oid_t *)g_hash_table_lookup(pres_ctx_oid_table, &pco);
264         if(tmppco){
265                 return tmppco->oid;
266         }
267         return NULL;
268 }
269
270
271
272 /*--- Included file: packet-pres-fn.c ---*/
273
274 /*--- Fields for imported types ---*/
275
276 static int dissect_x410_mode_parameters_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
277   return dissect_rtse_RTORQapdu(TRUE, tvb, offset, pinfo, tree, hf_pres_x410_mode_parameters);
278 }
279 static int dissect_cPR_PPDU_x400_mode_parameters_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
280   return dissect_rtse_RTOACapdu(TRUE, tvb, offset, pinfo, tree, hf_pres_cPR_PPDU_x400_mode_parameters);
281 }
282 static int dissect_cPU_PPDU_x400_mode_parameters(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
283   return dissect_rtse_RTORJapdu(FALSE, tvb, offset, pinfo, tree, hf_pres_cPU_PPDU_x400_mode_parameters);
284 }
285 static int dissect_aRU_PPDU_x400_mode_parameters(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
286   return dissect_rtse_RTABapdu(FALSE, tvb, offset, pinfo, tree, hf_pres_aRU_PPDU_x400_mode_parameters);
287 }
288
289
290 static const value_string pres_T_mode_value_vals[] = {
291   {   0, "x410-1984-mode" },
292   {   1, "normal-mode" },
293   { 0, NULL }
294 };
295
296
297 static int
298 dissect_pres_T_mode_value(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, 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_mode_value_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
305   return dissect_pres_T_mode_value(TRUE, tvb, offset, pinfo, tree, hf_pres_mode_value);
306 }
307
308
309 static const ber_sequence_t Mode_selector_set[] = {
310   { BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_mode_value_impl },
311   { 0, 0, 0, NULL }
312 };
313
314 static int
315 dissect_pres_Mode_selector(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
316   offset = dissect_ber_set(implicit_tag, pinfo, tree, tvb, offset,
317                               Mode_selector_set, hf_index, ett_pres_Mode_selector);
318
319   return offset;
320 }
321 static int dissect_mode_selector_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
322   return dissect_pres_Mode_selector(TRUE, tvb, offset, pinfo, tree, hf_pres_mode_selector);
323 }
324
325
326 static const asn_namedbit Protocol_version_bits[] = {
327   {  0, &hf_pres_Protocol_version_version_1, -1, -1, "version-1", NULL },
328   { 0, NULL, 0, 0, NULL, NULL }
329 };
330
331 static int
332 dissect_pres_Protocol_version(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
333   offset = dissect_ber_bitstring(implicit_tag, pinfo, tree, tvb, offset,
334                                     Protocol_version_bits, hf_index, ett_pres_Protocol_version,
335                                     NULL);
336
337   return offset;
338 }
339 static int dissect_protocol_version_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
340   return dissect_pres_Protocol_version(TRUE, tvb, offset, pinfo, tree, hf_pres_protocol_version);
341 }
342
343
344
345 static int
346 dissect_pres_Presentation_selector(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
347   offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
348                                        NULL);
349
350   return offset;
351 }
352
353
354
355 static int
356 dissect_pres_Calling_presentation_selector(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
357   offset = dissect_pres_Presentation_selector(implicit_tag, tvb, offset, pinfo, tree, hf_index);
358
359   return offset;
360 }
361 static int dissect_calling_presentation_selector_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
362   return dissect_pres_Calling_presentation_selector(TRUE, tvb, offset, pinfo, tree, hf_pres_calling_presentation_selector);
363 }
364
365
366
367 static int
368 dissect_pres_Called_presentation_selector(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
369   offset = dissect_pres_Presentation_selector(implicit_tag, tvb, offset, pinfo, tree, hf_index);
370
371   return offset;
372 }
373 static int dissect_called_presentation_selector_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
374   return dissect_pres_Called_presentation_selector(TRUE, tvb, offset, pinfo, tree, hf_pres_called_presentation_selector);
375 }
376
377
378
379 static int
380 dissect_pres_Presentation_context_identifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
381
382     offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
383                                   &presentation_context_identifier);
384
385
386   if(session)
387         session->pres_ctx_id = presentation_context_identifier;
388
389
390   return offset;
391 }
392 static int dissect_initiators_nominated_context(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
393   return dissect_pres_Presentation_context_identifier(FALSE, tvb, offset, pinfo, tree, hf_pres_initiators_nominated_context);
394 }
395 static int dissect_responders_nominated_context(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
396   return dissect_pres_Presentation_context_identifier(FALSE, tvb, offset, pinfo, tree, hf_pres_responders_nominated_context);
397 }
398 static int dissect_presentation_context_identifier(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
399   return dissect_pres_Presentation_context_identifier(FALSE, tvb, offset, pinfo, tree, hf_pres_presentation_context_identifier);
400 }
401 static int dissect_Presentation_context_deletion_list_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
402   return dissect_pres_Presentation_context_identifier(FALSE, tvb, offset, pinfo, tree, hf_pres_Presentation_context_deletion_list_item);
403 }
404
405
406
407 static int
408 dissect_pres_Abstract_syntax_name(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
409   offset = dissect_ber_object_identifier_str(implicit_tag, pinfo, tree, tvb, offset, hf_index, &abstract_syntax_name_oid);
410
411   return offset;
412 }
413 static int dissect_abstract_syntax_name(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
414   return dissect_pres_Abstract_syntax_name(FALSE, tvb, offset, pinfo, tree, hf_pres_abstract_syntax_name);
415 }
416 static int dissect_abstract_syntax_name_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
417   return dissect_pres_Abstract_syntax_name(TRUE, tvb, offset, pinfo, tree, hf_pres_abstract_syntax_name);
418 }
419
420
421
422 static int
423 dissect_pres_Transfer_syntax_name(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
424   offset = dissect_ber_object_identifier(implicit_tag, pinfo, tree, tvb, offset, hf_index, NULL);
425
426   return offset;
427 }
428 static int dissect_transfer_syntax_name_list_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
429   return dissect_pres_Transfer_syntax_name(FALSE, tvb, offset, pinfo, tree, hf_pres_transfer_syntax_name_list_item);
430 }
431 static int dissect_transfer_syntax_name(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
432   return dissect_pres_Transfer_syntax_name(FALSE, tvb, offset, pinfo, tree, hf_pres_transfer_syntax_name);
433 }
434 static int dissect_transfer_syntax_name_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
435   return dissect_pres_Transfer_syntax_name(TRUE, tvb, offset, pinfo, tree, hf_pres_transfer_syntax_name);
436 }
437
438
439 static const ber_sequence_t SEQUENCE_OF_Transfer_syntax_name_sequence_of[1] = {
440   { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_transfer_syntax_name_list_item },
441 };
442
443 static int
444 dissect_pres_SEQUENCE_OF_Transfer_syntax_name(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
445   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
446                                       SEQUENCE_OF_Transfer_syntax_name_sequence_of, hf_index, ett_pres_SEQUENCE_OF_Transfer_syntax_name);
447
448   return offset;
449 }
450 static int dissect_transfer_syntax_name_list(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
451   return dissect_pres_SEQUENCE_OF_Transfer_syntax_name(FALSE, tvb, offset, pinfo, tree, hf_pres_transfer_syntax_name_list);
452 }
453
454
455 static const ber_sequence_t Context_list_item_sequence[] = {
456   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_presentation_context_identifier },
457   { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_abstract_syntax_name },
458   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_transfer_syntax_name_list },
459   { 0, 0, 0, NULL }
460 };
461
462 static int
463 dissect_pres_Context_list_item(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
464   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
465                                    Context_list_item_sequence, hf_index, ett_pres_Context_list_item);
466
467         register_ctx_id_and_oid(pinfo, presentation_context_identifier, abstract_syntax_name_oid);
468   return offset;
469 }
470 static int dissect_Context_list_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
471   return dissect_pres_Context_list_item(FALSE, tvb, offset, pinfo, tree, hf_pres_Context_list_item);
472 }
473
474
475 static const ber_sequence_t Context_list_sequence_of[1] = {
476   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_Context_list_item },
477 };
478
479 static int
480 dissect_pres_Context_list(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
481   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
482                                       Context_list_sequence_of, hf_index, ett_pres_Context_list);
483
484   return offset;
485 }
486
487
488
489 static int
490 dissect_pres_Presentation_context_definition_list(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
491   offset = dissect_pres_Context_list(implicit_tag, tvb, offset, pinfo, tree, hf_index);
492
493   return offset;
494 }
495 static int dissect_presentation_context_definition_list_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
496   return dissect_pres_Presentation_context_definition_list(TRUE, tvb, offset, pinfo, tree, hf_pres_presentation_context_definition_list);
497 }
498
499
500 static const ber_sequence_t Default_context_name_sequence[] = {
501   { BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_abstract_syntax_name_impl },
502   { BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_transfer_syntax_name_impl },
503   { 0, 0, 0, NULL }
504 };
505
506 static int
507 dissect_pres_Default_context_name(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
508   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
509                                    Default_context_name_sequence, hf_index, ett_pres_Default_context_name);
510
511   return offset;
512 }
513 static int dissect_default_context_name_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
514   return dissect_pres_Default_context_name(TRUE, tvb, offset, pinfo, tree, hf_pres_default_context_name);
515 }
516
517
518 static const asn_namedbit Presentation_requirements_bits[] = {
519   {  0, &hf_pres_Presentation_requirements_context_management, -1, -1, "context-management", NULL },
520   {  1, &hf_pres_Presentation_requirements_restoration, -1, -1, "restoration", NULL },
521   { 0, NULL, 0, 0, NULL, NULL }
522 };
523
524 static int
525 dissect_pres_Presentation_requirements(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
526   offset = dissect_ber_bitstring(implicit_tag, pinfo, tree, tvb, offset,
527                                     Presentation_requirements_bits, hf_index, ett_pres_Presentation_requirements,
528                                     NULL);
529
530   return offset;
531 }
532 static int dissect_presentation_requirements_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
533   return dissect_pres_Presentation_requirements(TRUE, tvb, offset, pinfo, tree, hf_pres_presentation_requirements);
534 }
535
536
537 static const asn_namedbit User_session_requirements_bits[] = {
538   {  0, &hf_pres_User_session_requirements_half_duplex, -1, -1, "half-duplex", NULL },
539   {  1, &hf_pres_User_session_requirements_duplex, -1, -1, "duplex", NULL },
540   {  2, &hf_pres_User_session_requirements_expedited_data, -1, -1, "expedited-data", NULL },
541   {  3, &hf_pres_User_session_requirements_minor_synchronize, -1, -1, "minor-synchronize", NULL },
542   {  4, &hf_pres_User_session_requirements_major_synchronize, -1, -1, "major-synchronize", NULL },
543   {  5, &hf_pres_User_session_requirements_resynchronize, -1, -1, "resynchronize", NULL },
544   {  6, &hf_pres_User_session_requirements_activity_management, -1, -1, "activity-management", NULL },
545   {  7, &hf_pres_User_session_requirements_negotiated_release, -1, -1, "negotiated-release", NULL },
546   {  8, &hf_pres_User_session_requirements_capability_data, -1, -1, "capability-data", NULL },
547   {  9, &hf_pres_User_session_requirements_exceptions, -1, -1, "exceptions", NULL },
548   { 10, &hf_pres_User_session_requirements_typed_data, -1, -1, "typed-data", NULL },
549   { 11, &hf_pres_User_session_requirements_symmetric_synchronize, -1, -1, "symmetric-synchronize", NULL },
550   { 12, &hf_pres_User_session_requirements_data_separation, -1, -1, "data-separation", NULL },
551   { 0, NULL, 0, 0, NULL, NULL }
552 };
553
554 static int
555 dissect_pres_User_session_requirements(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
556   offset = dissect_ber_bitstring(implicit_tag, pinfo, tree, tvb, offset,
557                                     User_session_requirements_bits, hf_index, ett_pres_User_session_requirements,
558                                     NULL);
559
560   return offset;
561 }
562 static int dissect_user_session_requirements_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
563   return dissect_pres_User_session_requirements(TRUE, tvb, offset, pinfo, tree, hf_pres_user_session_requirements);
564 }
565
566
567 static const asn_namedbit Protocol_options_bits[] = {
568   {  0, &hf_pres_Protocol_options_nominated_context, -1, -1, "nominated-context", NULL },
569   {  1, &hf_pres_Protocol_options_short_encoding, -1, -1, "short-encoding", NULL },
570   {  2, &hf_pres_Protocol_options_packed_encoding_rules, -1, -1, "packed-encoding-rules", NULL },
571   { 0, NULL, 0, 0, NULL, NULL }
572 };
573
574 static int
575 dissect_pres_Protocol_options(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
576   offset = dissect_ber_bitstring(implicit_tag, pinfo, tree, tvb, offset,
577                                     Protocol_options_bits, hf_index, ett_pres_Protocol_options,
578                                     NULL);
579
580   return offset;
581 }
582 static int dissect_protocol_options(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
583   return dissect_pres_Protocol_options(FALSE, tvb, offset, pinfo, tree, hf_pres_protocol_options);
584 }
585
586
587 static const ber_sequence_t T_extensions_sequence[] = {
588   { 0, 0, 0, NULL }
589 };
590
591 static int
592 dissect_pres_T_extensions(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
593   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
594                                    T_extensions_sequence, hf_index, ett_pres_T_extensions);
595
596   return offset;
597 }
598 static int dissect_extensions(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
599   return dissect_pres_T_extensions(FALSE, tvb, offset, pinfo, tree, hf_pres_extensions);
600 }
601
602
603
604 static int
605 dissect_pres_Simply_encoded_data(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
606   offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
607                                        NULL);
608
609   return offset;
610 }
611 static int dissect_simply_encoded_data_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
612   return dissect_pres_Simply_encoded_data(TRUE, tvb, offset, pinfo, tree, hf_pres_simply_encoded_data);
613 }
614
615
616
617 static int
618 dissect_pres_T_single_ASN1_type(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
619
620  tvbuff_t       *next_tvb;
621  char *oid; 
622
623         oid=find_oid_by_pres_ctx_id(pinfo, presentation_context_identifier);
624         if(oid){
625                 next_tvb = tvb_new_subset(tvb, offset, -1, -1);
626                 call_ber_oid_callback(oid, next_tvb, offset, pinfo, global_tree);
627         } else {
628                 proto_tree_add_text(tree, tvb, offset, -1,"dissector is not available");
629                   offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
630                                        NULL);
631         
632         }
633
634   return offset;
635 }
636 static int dissect_single_ASN1_type_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
637   return dissect_pres_T_single_ASN1_type(TRUE, tvb, offset, pinfo, tree, hf_pres_single_ASN1_type);
638 }
639
640
641
642 static int
643 dissect_pres_T_octet_aligned(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
644
645  tvbuff_t       *next_tvb;
646  char *oid; 
647
648         oid=find_oid_by_pres_ctx_id(pinfo, presentation_context_identifier);
649         if(oid){
650                 next_tvb = tvb_new_subset(tvb, offset, -1, -1);
651                 call_ber_oid_callback(oid, next_tvb, offset, pinfo, global_tree);
652         } else {
653                 proto_tree_add_text(tree, tvb, offset, -1,"dissector is not available");
654                   offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
655                                        NULL);
656         
657         }
658
659
660
661   return offset;
662 }
663 static int dissect_octet_aligned_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
664   return dissect_pres_T_octet_aligned(TRUE, tvb, offset, pinfo, tree, hf_pres_octet_aligned);
665 }
666
667
668
669 static int
670 dissect_pres_BIT_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
671   offset = dissect_ber_bitstring(implicit_tag, pinfo, tree, tvb, offset,
672                                     NULL, hf_index, -1,
673                                     NULL);
674
675   return offset;
676 }
677 static int dissect_arbitrary_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
678   return dissect_pres_BIT_STRING(TRUE, tvb, offset, pinfo, tree, hf_pres_arbitrary);
679 }
680
681
682 static const value_string pres_T_presentation_data_values_vals[] = {
683   {   0, "single-ASN1-type" },
684   {   1, "octet-aligned" },
685   {   2, "arbitrary" },
686   { 0, NULL }
687 };
688
689 static const ber_choice_t T_presentation_data_values_choice[] = {
690   {   0, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_single_ASN1_type_impl },
691   {   1, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_octet_aligned_impl },
692   {   2, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_arbitrary_impl },
693   { 0, 0, 0, 0, NULL }
694 };
695
696 static int
697 dissect_pres_T_presentation_data_values(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
698   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
699                                  T_presentation_data_values_choice, hf_index, ett_pres_T_presentation_data_values,
700                                  NULL);
701
702   return offset;
703 }
704 static int dissect_presentation_data_values(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
705   return dissect_pres_T_presentation_data_values(FALSE, tvb, offset, pinfo, tree, hf_pres_presentation_data_values);
706 }
707
708
709 static const ber_sequence_t PDV_list_sequence[] = {
710   { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_transfer_syntax_name },
711   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_presentation_context_identifier },
712   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_presentation_data_values },
713   { 0, 0, 0, NULL }
714 };
715
716 static int
717 dissect_pres_PDV_list(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
718   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
719                                    PDV_list_sequence, hf_index, ett_pres_PDV_list);
720
721   return offset;
722 }
723 static int dissect_Fully_encoded_data_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
724   return dissect_pres_PDV_list(FALSE, tvb, offset, pinfo, tree, hf_pres_Fully_encoded_data_item);
725 }
726
727
728 static const ber_sequence_t Fully_encoded_data_sequence_of[1] = {
729   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_Fully_encoded_data_item },
730 };
731
732 static int
733 dissect_pres_Fully_encoded_data(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
734   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
735                                       Fully_encoded_data_sequence_of, hf_index, ett_pres_Fully_encoded_data);
736
737   return offset;
738 }
739 static int dissect_fully_encoded_data_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
740   return dissect_pres_Fully_encoded_data(TRUE, tvb, offset, pinfo, tree, hf_pres_fully_encoded_data);
741 }
742
743
744 static const value_string pres_User_data_vals[] = {
745   {   0, "simply-encoded-data" },
746   {   1, "fully-encoded-data" },
747   { 0, NULL }
748 };
749
750 static const ber_choice_t User_data_choice[] = {
751   {   0, BER_CLASS_APP, 0, BER_FLAGS_IMPLTAG, dissect_simply_encoded_data_impl },
752   {   1, BER_CLASS_APP, 1, BER_FLAGS_IMPLTAG, dissect_fully_encoded_data_impl },
753   { 0, 0, 0, 0, NULL }
754 };
755
756 static int
757 dissect_pres_User_data(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
758   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
759                                  User_data_choice, hf_index, ett_pres_User_data,
760                                  NULL);
761
762   return offset;
763 }
764 static int dissect_user_data(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
765   return dissect_pres_User_data(FALSE, tvb, offset, pinfo, tree, hf_pres_user_data);
766 }
767 static int dissect_ttdPPDU(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
768   return dissect_pres_User_data(FALSE, tvb, offset, pinfo, tree, hf_pres_ttdPPDU);
769 }
770
771
772 static const ber_sequence_t T_normal_mode_parameters_sequence[] = {
773   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_protocol_version_impl },
774   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_calling_presentation_selector_impl },
775   { BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_called_presentation_selector_impl },
776   { BER_CLASS_CON, 4, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_presentation_context_definition_list_impl },
777   { BER_CLASS_CON, 6, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_default_context_name_impl },
778   { BER_CLASS_CON, 8, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_presentation_requirements_impl },
779   { BER_CLASS_CON, 9, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_user_session_requirements_impl },
780   { BER_CLASS_CON, 11, BER_FLAGS_OPTIONAL, dissect_protocol_options },
781   { BER_CLASS_CON, 12, BER_FLAGS_OPTIONAL, dissect_initiators_nominated_context },
782   { BER_CLASS_CON, 14, BER_FLAGS_OPTIONAL, dissect_extensions },
783   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_user_data },
784   { 0, 0, 0, NULL }
785 };
786
787 static int
788 dissect_pres_T_normal_mode_parameters(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
789   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
790                                    T_normal_mode_parameters_sequence, hf_index, ett_pres_T_normal_mode_parameters);
791
792   return offset;
793 }
794 static int dissect_normal_mode_parameters_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
795   return dissect_pres_T_normal_mode_parameters(TRUE, tvb, offset, pinfo, tree, hf_pres_normal_mode_parameters);
796 }
797
798
799 static const ber_sequence_t CP_type_set[] = {
800   { BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_mode_selector_impl },
801   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_x410_mode_parameters_impl },
802   { BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_normal_mode_parameters_impl },
803   { 0, 0, 0, NULL }
804 };
805
806 static int
807 dissect_pres_CP_type(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
808   offset = dissect_ber_set(implicit_tag, pinfo, tree, tvb, offset,
809                               CP_type_set, hf_index, ett_pres_CP_type);
810
811   return offset;
812 }
813
814
815
816 static int
817 dissect_pres_CPC_type(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
818   offset = dissect_pres_User_data(implicit_tag, tvb, offset, pinfo, tree, hf_index);
819
820   return offset;
821 }
822
823
824
825 static int
826 dissect_pres_Responding_presentation_selector(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
827   offset = dissect_pres_Presentation_selector(implicit_tag, tvb, offset, pinfo, tree, hf_index);
828
829   return offset;
830 }
831 static int dissect_responding_presentation_selector_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
832   return dissect_pres_Responding_presentation_selector(TRUE, tvb, offset, pinfo, tree, hf_pres_responding_presentation_selector);
833 }
834
835
836 static const value_string pres_Result_vals[] = {
837   {   0, "acceptance" },
838   {   1, "user-rejection" },
839   {   2, "provider-rejection" },
840   { 0, NULL }
841 };
842
843
844 static int
845 dissect_pres_Result(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
846   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
847                                   NULL);
848
849   return offset;
850 }
851 static int dissect_result_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
852   return dissect_pres_Result(TRUE, tvb, offset, pinfo, tree, hf_pres_result);
853 }
854
855
856 static const value_string pres_T_provider_reason_vals[] = {
857   {   0, "reason-not-specified" },
858   {   1, "abstract-syntax-not-supported" },
859   {   2, "proposed-transfer-syntaxes-not-supported" },
860   {   3, "local-limit-on-DCS-exceeded" },
861   { 0, NULL }
862 };
863
864
865 static int
866 dissect_pres_T_provider_reason(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
867   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
868                                   NULL);
869
870   return offset;
871 }
872 static int dissect_provider_reason_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
873   return dissect_pres_T_provider_reason(TRUE, tvb, offset, pinfo, tree, hf_pres_provider_reason);
874 }
875
876
877 static const ber_sequence_t Result_list_item_sequence[] = {
878   { BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_result_impl },
879   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_transfer_syntax_name_impl },
880   { BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_provider_reason_impl },
881   { 0, 0, 0, NULL }
882 };
883
884 static int
885 dissect_pres_Result_list_item(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
886   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
887                                    Result_list_item_sequence, hf_index, ett_pres_Result_list_item);
888
889   return offset;
890 }
891 static int dissect_Result_list_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
892   return dissect_pres_Result_list_item(FALSE, tvb, offset, pinfo, tree, hf_pres_Result_list_item);
893 }
894
895
896 static const ber_sequence_t Result_list_sequence_of[1] = {
897   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_Result_list_item },
898 };
899
900 static int
901 dissect_pres_Result_list(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
902   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
903                                       Result_list_sequence_of, hf_index, ett_pres_Result_list);
904
905   return offset;
906 }
907
908
909
910 static int
911 dissect_pres_Presentation_context_definition_result_list(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
912   offset = dissect_pres_Result_list(implicit_tag, tvb, offset, pinfo, tree, hf_index);
913
914   return offset;
915 }
916 static int dissect_presentation_context_definition_result_list_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
917   return dissect_pres_Presentation_context_definition_result_list(TRUE, tvb, offset, pinfo, tree, hf_pres_presentation_context_definition_result_list);
918 }
919
920
921 static const ber_sequence_t T_CPA_PPDU_normal_mode_parameters_sequence[] = {
922   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_protocol_version_impl },
923   { BER_CLASS_CON, 3, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_responding_presentation_selector_impl },
924   { BER_CLASS_CON, 5, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_presentation_context_definition_result_list_impl },
925   { BER_CLASS_CON, 8, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_presentation_requirements_impl },
926   { BER_CLASS_CON, 9, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_user_session_requirements_impl },
927   { BER_CLASS_CON, 11, BER_FLAGS_OPTIONAL, dissect_protocol_options },
928   { BER_CLASS_CON, 13, BER_FLAGS_OPTIONAL, dissect_responders_nominated_context },
929   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_user_data },
930   { 0, 0, 0, NULL }
931 };
932
933 static int
934 dissect_pres_T_CPA_PPDU_normal_mode_parameters(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
935   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
936                                    T_CPA_PPDU_normal_mode_parameters_sequence, hf_index, ett_pres_T_CPA_PPDU_normal_mode_parameters);
937
938   return offset;
939 }
940 static int dissect_cPU_PPDU_normal_mode_parameters_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
941   return dissect_pres_T_CPA_PPDU_normal_mode_parameters(TRUE, tvb, offset, pinfo, tree, hf_pres_cPU_PPDU_normal_mode_parameters);
942 }
943
944
945 static const ber_sequence_t CPA_PPDU_set[] = {
946   { BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_mode_selector_impl },
947   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_cPR_PPDU_x400_mode_parameters_impl },
948   { BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_cPU_PPDU_normal_mode_parameters_impl },
949   { 0, 0, 0, NULL }
950 };
951
952 static int
953 dissect_pres_CPA_PPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
954   offset = dissect_ber_set(implicit_tag, pinfo, tree, tvb, offset,
955                               CPA_PPDU_set, hf_index, ett_pres_CPA_PPDU);
956
957   return offset;
958 }
959
960
961
962 static int
963 dissect_pres_Default_context_result(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
964   offset = dissect_pres_Result(implicit_tag, tvb, offset, pinfo, tree, hf_index);
965
966   return offset;
967 }
968 static int dissect_default_context_result_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
969   return dissect_pres_Default_context_result(TRUE, tvb, offset, pinfo, tree, hf_pres_default_context_result);
970 }
971
972
973 static const value_string pres_Provider_reason_vals[] = {
974   {   0, "reason-not-specified" },
975   {   1, "temporary-congestion" },
976   {   2, "local-limit-exceeded" },
977   {   3, "called-presentation-address-unknown" },
978   {   4, "protocol-version-not-supported" },
979   {   5, "default-context-not-supported" },
980   {   6, "user-data-not-readable" },
981   {   7, "no-PSAP-available" },
982   { 0, NULL }
983 };
984
985
986 static int
987 dissect_pres_Provider_reason(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
988   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
989                                   NULL);
990
991   return offset;
992 }
993 static int dissect_cPR_PPDU__provider_reason_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
994   return dissect_pres_Provider_reason(TRUE, tvb, offset, pinfo, tree, hf_pres_cPR_PPDU__provider_reason);
995 }
996
997
998 static const ber_sequence_t T_CPR_PPDU_normal_mode_parameters_sequence[] = {
999   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_protocol_version_impl },
1000   { BER_CLASS_CON, 3, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_responding_presentation_selector_impl },
1001   { BER_CLASS_CON, 5, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_presentation_context_definition_result_list_impl },
1002   { BER_CLASS_CON, 7, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_default_context_result_impl },
1003   { BER_CLASS_CON, 10, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_cPR_PPDU__provider_reason_impl },
1004   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_user_data },
1005   { 0, 0, 0, NULL }
1006 };
1007
1008 static int
1009 dissect_pres_T_CPR_PPDU_normal_mode_parameters(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1010   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1011                                    T_CPR_PPDU_normal_mode_parameters_sequence, hf_index, ett_pres_T_CPR_PPDU_normal_mode_parameters);
1012
1013   return offset;
1014 }
1015 static int dissect_cPR_PPDU_normal_mode_parameters(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1016   return dissect_pres_T_CPR_PPDU_normal_mode_parameters(FALSE, tvb, offset, pinfo, tree, hf_pres_cPR_PPDU_normal_mode_parameters);
1017 }
1018
1019
1020 static const value_string pres_CPR_PPDU_vals[] = {
1021   {   0, "x400-mode-parameters" },
1022   {   1, "normal-mode-parameters" },
1023   { 0, NULL }
1024 };
1025
1026 static const ber_choice_t CPR_PPDU_choice[] = {
1027   {   0, BER_CLASS_UNI, BER_UNI_TAG_SET, BER_FLAGS_NOOWNTAG, dissect_cPU_PPDU_x400_mode_parameters },
1028   {   1, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_cPR_PPDU_normal_mode_parameters },
1029   { 0, 0, 0, 0, NULL }
1030 };
1031
1032 static int
1033 dissect_pres_CPR_PPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1034   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
1035                                  CPR_PPDU_choice, hf_index, ett_pres_CPR_PPDU,
1036                                  NULL);
1037
1038   return offset;
1039 }
1040
1041
1042 static const ber_sequence_t Presentation_context_identifier_list_item_sequence[] = {
1043   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_presentation_context_identifier },
1044   { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_transfer_syntax_name },
1045   { 0, 0, 0, NULL }
1046 };
1047
1048 static int
1049 dissect_pres_Presentation_context_identifier_list_item(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1050   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1051                                    Presentation_context_identifier_list_item_sequence, hf_index, ett_pres_Presentation_context_identifier_list_item);
1052
1053   return offset;
1054 }
1055 static int dissect_Presentation_context_identifier_list_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1056   return dissect_pres_Presentation_context_identifier_list_item(FALSE, tvb, offset, pinfo, tree, hf_pres_Presentation_context_identifier_list_item);
1057 }
1058
1059
1060 static const ber_sequence_t Presentation_context_identifier_list_sequence_of[1] = {
1061   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_Presentation_context_identifier_list_item },
1062 };
1063
1064 static int
1065 dissect_pres_Presentation_context_identifier_list(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1066   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
1067                                       Presentation_context_identifier_list_sequence_of, hf_index, ett_pres_Presentation_context_identifier_list);
1068
1069   return offset;
1070 }
1071 static int dissect_presentation_context_identifier_list_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1072   return dissect_pres_Presentation_context_identifier_list(TRUE, tvb, offset, pinfo, tree, hf_pres_presentation_context_identifier_list);
1073 }
1074
1075
1076 static const ber_sequence_t T_ARU_PPDU_normal_mode_parameters_sequence[] = {
1077   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_presentation_context_identifier_list_impl },
1078   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_user_data },
1079   { 0, 0, 0, NULL }
1080 };
1081
1082 static int
1083 dissect_pres_T_ARU_PPDU_normal_mode_parameters(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1084   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1085                                    T_ARU_PPDU_normal_mode_parameters_sequence, hf_index, ett_pres_T_ARU_PPDU_normal_mode_parameters);
1086
1087   return offset;
1088 }
1089 static int dissect_aRU_PPDU_normal_mode_parameters_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1090   return dissect_pres_T_ARU_PPDU_normal_mode_parameters(TRUE, tvb, offset, pinfo, tree, hf_pres_aRU_PPDU_normal_mode_parameters);
1091 }
1092
1093
1094 static const value_string pres_ARU_PPDU_vals[] = {
1095   {   0, "x400-mode-parameters" },
1096   {   1, "normal-mode-parameters" },
1097   { 0, NULL }
1098 };
1099
1100 static const ber_choice_t ARU_PPDU_choice[] = {
1101   {   0, BER_CLASS_UNI, BER_UNI_TAG_SET, BER_FLAGS_NOOWNTAG, dissect_aRU_PPDU_x400_mode_parameters },
1102   {   1, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_aRU_PPDU_normal_mode_parameters_impl },
1103   { 0, 0, 0, 0, NULL }
1104 };
1105
1106 static int
1107 dissect_pres_ARU_PPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1108   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
1109                                  ARU_PPDU_choice, hf_index, ett_pres_ARU_PPDU,
1110                                  NULL);
1111
1112   return offset;
1113 }
1114 static int dissect_aru_ppdu(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1115   return dissect_pres_ARU_PPDU(FALSE, tvb, offset, pinfo, tree, hf_pres_aru_ppdu);
1116 }
1117
1118
1119 static const value_string pres_Abort_reason_vals[] = {
1120   {   0, "reason-not-specified" },
1121   {   1, "unrecognized-ppdu" },
1122   {   2, "unexpected-ppdu" },
1123   {   3, "unexpected-session-service-primitive" },
1124   {   4, "unrecognized-ppdu-parameter" },
1125   {   5, "unexpected-ppdu-parameter" },
1126   {   6, "invalid-ppdu-parameter-value" },
1127   { 0, NULL }
1128 };
1129
1130
1131 static int
1132 dissect_pres_Abort_reason(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1133   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
1134                                   NULL);
1135
1136   return offset;
1137 }
1138 static int dissect_aRU_PPDU_provider_reason_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1139   return dissect_pres_Abort_reason(TRUE, tvb, offset, pinfo, tree, hf_pres_aRU_PPDU_provider_reason);
1140 }
1141
1142
1143 static const value_string pres_Event_identifier_vals[] = {
1144   {   0, "cp-PPDU" },
1145   {   1, "cpa-PPDU" },
1146   {   2, "cpr-PPDU" },
1147   {   3, "aru-PPDU" },
1148   {   4, "arp-PPDU" },
1149   {   5, "ac-PPDU" },
1150   {   6, "aca-PPDU" },
1151   {   7, "td-PPDU" },
1152   {   8, "ttd-PPDU" },
1153   {   9, "te-PPDU" },
1154   {  10, "tc-PPDU" },
1155   {  11, "tcc-PPDU" },
1156   {  12, "rs-PPDU" },
1157   {  13, "rsa-PPDU" },
1158   {  14, "s-release-indication" },
1159   {  15, "s-release-confirm" },
1160   {  16, "s-token-give-indication" },
1161   {  17, "s-token-please-indication" },
1162   {  18, "s-control-give-indication" },
1163   {  19, "s-sync-minor-indication" },
1164   {  20, "s-sync-minor-confirm" },
1165   {  21, "s-sync-major-indication" },
1166   {  22, "s-sync-major-confirm" },
1167   {  23, "s-p-exception-report-indication" },
1168   {  24, "s-u-exception-report-indication" },
1169   {  25, "s-activity-start-indication" },
1170   {  26, "s-activity-resume-indication" },
1171   {  27, "s-activity-interrupt-indication" },
1172   {  28, "s-activity-interrupt-confirm" },
1173   {  29, "s-activity-discard-indication" },
1174   {  30, "s-activity-discard-confirm" },
1175   {  31, "s-activity-end-indication" },
1176   {  32, "s-activity-end-confirm" },
1177   { 0, NULL }
1178 };
1179
1180
1181 static int
1182 dissect_pres_Event_identifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1183   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
1184                                   NULL);
1185
1186   return offset;
1187 }
1188 static int dissect_event_identifier_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1189   return dissect_pres_Event_identifier(TRUE, tvb, offset, pinfo, tree, hf_pres_event_identifier);
1190 }
1191
1192
1193 static const ber_sequence_t ARP_PPDU_sequence[] = {
1194   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_aRU_PPDU_provider_reason_impl },
1195   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_event_identifier_impl },
1196   { 0, 0, 0, NULL }
1197 };
1198
1199 static int
1200 dissect_pres_ARP_PPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1201   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1202                                    ARP_PPDU_sequence, hf_index, ett_pres_ARP_PPDU);
1203
1204   return offset;
1205 }
1206 static int dissect_arp_ppdu(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1207   return dissect_pres_ARP_PPDU(FALSE, tvb, offset, pinfo, tree, hf_pres_arp_ppdu);
1208 }
1209
1210
1211 static const value_string pres_Abort_type_vals[] = {
1212   {   0, "aru-ppdu" },
1213   {   1, "arp-ppdu" },
1214   { 0, NULL }
1215 };
1216
1217 static const ber_choice_t Abort_type_choice[] = {
1218   {   0, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG, dissect_aru_ppdu },
1219   {   1, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_arp_ppdu },
1220   { 0, 0, 0, 0, NULL }
1221 };
1222
1223 static int
1224 dissect_pres_Abort_type(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1225   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
1226                                  Abort_type_choice, hf_index, ett_pres_Abort_type,
1227                                  NULL);
1228
1229   return offset;
1230 }
1231
1232
1233
1234 static int
1235 dissect_pres_Presentation_context_addition_list(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1236   offset = dissect_pres_Context_list(implicit_tag, tvb, offset, pinfo, tree, hf_index);
1237
1238   return offset;
1239 }
1240 static int dissect_presentation_context_addition_list_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1241   return dissect_pres_Presentation_context_addition_list(TRUE, tvb, offset, pinfo, tree, hf_pres_presentation_context_addition_list);
1242 }
1243
1244
1245 static const ber_sequence_t Presentation_context_deletion_list_sequence_of[1] = {
1246   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_Presentation_context_deletion_list_item },
1247 };
1248
1249 static int
1250 dissect_pres_Presentation_context_deletion_list(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1251   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
1252                                       Presentation_context_deletion_list_sequence_of, hf_index, ett_pres_Presentation_context_deletion_list);
1253
1254   return offset;
1255 }
1256 static int dissect_presentation_context_deletion_list_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1257   return dissect_pres_Presentation_context_deletion_list(TRUE, tvb, offset, pinfo, tree, hf_pres_presentation_context_deletion_list);
1258 }
1259
1260
1261 static const ber_sequence_t AC_PPDU_sequence[] = {
1262   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_presentation_context_addition_list_impl },
1263   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_presentation_context_deletion_list_impl },
1264   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_user_data },
1265   { 0, 0, 0, NULL }
1266 };
1267
1268 static int
1269 dissect_pres_AC_PPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1270   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1271                                    AC_PPDU_sequence, hf_index, ett_pres_AC_PPDU);
1272
1273   return offset;
1274 }
1275 static int dissect_acPPDU_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1276   return dissect_pres_AC_PPDU(TRUE, tvb, offset, pinfo, tree, hf_pres_acPPDU);
1277 }
1278
1279
1280
1281 static int
1282 dissect_pres_Presentation_context_addition_result_list(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1283   offset = dissect_pres_Result_list(implicit_tag, tvb, offset, pinfo, tree, hf_index);
1284
1285   return offset;
1286 }
1287 static int dissect_presentation_context_addition_result_list_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1288   return dissect_pres_Presentation_context_addition_result_list(TRUE, tvb, offset, pinfo, tree, hf_pres_presentation_context_addition_result_list);
1289 }
1290
1291
1292 static const value_string pres_Presentation_context_deletion_result_list_item_vals[] = {
1293   {   0, "acceptance" },
1294   {   1, "user-rejection" },
1295   { 0, NULL }
1296 };
1297
1298
1299 static int
1300 dissect_pres_Presentation_context_deletion_result_list_item(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1301   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
1302                                   NULL);
1303
1304   return offset;
1305 }
1306 static int dissect_Presentation_context_deletion_result_list_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1307   return dissect_pres_Presentation_context_deletion_result_list_item(FALSE, tvb, offset, pinfo, tree, hf_pres_Presentation_context_deletion_result_list_item);
1308 }
1309
1310
1311 static const ber_sequence_t Presentation_context_deletion_result_list_sequence_of[1] = {
1312   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_Presentation_context_deletion_result_list_item },
1313 };
1314
1315 static int
1316 dissect_pres_Presentation_context_deletion_result_list(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1317   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
1318                                       Presentation_context_deletion_result_list_sequence_of, hf_index, ett_pres_Presentation_context_deletion_result_list);
1319
1320   return offset;
1321 }
1322 static int dissect_presentation_context_deletion_result_list_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1323   return dissect_pres_Presentation_context_deletion_result_list(TRUE, tvb, offset, pinfo, tree, hf_pres_presentation_context_deletion_result_list);
1324 }
1325
1326
1327 static const ber_sequence_t ACA_PPDU_sequence[] = {
1328   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_presentation_context_addition_result_list_impl },
1329   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_presentation_context_deletion_result_list_impl },
1330   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_user_data },
1331   { 0, 0, 0, NULL }
1332 };
1333
1334 static int
1335 dissect_pres_ACA_PPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1336   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1337                                    ACA_PPDU_sequence, hf_index, ett_pres_ACA_PPDU);
1338
1339   return offset;
1340 }
1341 static int dissect_acaPPDU_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1342   return dissect_pres_ACA_PPDU(TRUE, tvb, offset, pinfo, tree, hf_pres_acaPPDU);
1343 }
1344
1345
1346 static const value_string pres_Typed_data_type_vals[] = {
1347   {   0, "acPPDU" },
1348   {   1, "acaPPDU" },
1349   {   2, "ttdPPDU" },
1350   { 0, NULL }
1351 };
1352
1353 static const ber_choice_t Typed_data_type_choice[] = {
1354   {   0, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_acPPDU_impl },
1355   {   1, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_acaPPDU_impl },
1356   {   2, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG, dissect_ttdPPDU },
1357   { 0, 0, 0, 0, NULL }
1358 };
1359
1360 static int
1361 dissect_pres_Typed_data_type(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1362   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
1363                                  Typed_data_type_choice, hf_index, ett_pres_Typed_data_type,
1364                                  NULL);
1365
1366   return offset;
1367 }
1368
1369
1370 static const ber_sequence_t RS_PPDU_sequence[] = {
1371   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_presentation_context_identifier_list_impl },
1372   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_user_data },
1373   { 0, 0, 0, NULL }
1374 };
1375
1376 static int
1377 dissect_pres_RS_PPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1378   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1379                                    RS_PPDU_sequence, hf_index, ett_pres_RS_PPDU);
1380
1381   return offset;
1382 }
1383
1384
1385 static const ber_sequence_t RSA_PPDU_sequence[] = {
1386   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_presentation_context_identifier_list_impl },
1387   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_user_data },
1388   { 0, 0, 0, NULL }
1389 };
1390
1391 static int
1392 dissect_pres_RSA_PPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1393   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1394                                    RSA_PPDU_sequence, hf_index, ett_pres_RSA_PPDU);
1395
1396   return offset;
1397 }
1398
1399
1400 /*--- End of included file: packet-pres-fn.c ---*/
1401
1402
1403
1404 /*
1405  * Dissect an PPDU.
1406  */
1407 static int
1408 dissect_ppdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
1409 {
1410   proto_item *ti;
1411   proto_tree *pres_tree = NULL;
1412   guint s_type;
1413 /* do we have spdu type from the session dissector?  */
1414         if( !pinfo->private_data ){
1415                 if(tree){
1416                         proto_tree_add_text(tree, tvb, offset, -1,
1417                                 "Internal error:can't get spdu type from session dissector.");
1418                         return  FALSE;
1419                 }
1420         }else{
1421                 session  = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) );
1422                 if(session->spdu_type == 0 ){
1423                         if(tree){
1424                                 proto_tree_add_text(tree, tvb, offset, -1,
1425                                         "Internal error:wrong spdu type %x from session dissector.",session->spdu_type);
1426                                 return  FALSE;
1427                         }
1428                 }
1429         }
1430 /* get type of tag      */
1431         s_type = tvb_get_guint8(tvb, offset);
1432                 /*  set up type of Ppdu */
1433         if (check_col(pinfo->cinfo, COL_INFO))
1434                                         col_add_str(pinfo->cinfo, COL_INFO,
1435                                                 val_to_str(session->spdu_type, ses_vals, "Unknown Ppdu type (0x%02x)"));
1436   if (tree){
1437           ti = proto_tree_add_item(tree, proto_pres, tvb, offset, -1,
1438                     FALSE);
1439           pres_tree = proto_item_add_subtree(ti, ett_pres);
1440   }
1441
1442         switch(session->spdu_type){
1443                 case SES_CONNECTION_REQUEST:
1444                         offset = dissect_pres_CP_type(FALSE, tvb, offset, pinfo, pres_tree, hf_pres_CP_type);
1445                         break;
1446                 case SES_CONNECTION_ACCEPT:
1447                         offset = dissect_pres_CPA_PPDU(FALSE, tvb, offset, pinfo, pres_tree, hf_pres_CPA_PPDU);
1448                         break;
1449                 case SES_ABORT:
1450                 case SES_ABORT_ACCEPT:
1451                         offset = dissect_pres_Abort_type(FALSE, tvb, offset, pinfo, pres_tree, hf_pres_Abort_type);
1452                         break;
1453                 case SES_DATA_TRANSFER:
1454                         offset = dissect_pres_CPC_type(FALSE, tvb, offset, pinfo, pres_tree, hf_pres_user_data);
1455                         break;
1456                 case SES_TYPED_DATA:
1457                         offset = dissect_pres_Typed_data_type(FALSE, tvb, offset, pinfo, pres_tree, hf_pres_Typed_data_type);
1458                         break;
1459                 case SES_RESYNCHRONIZE:
1460                         offset = dissect_pres_RS_PPDU(FALSE, tvb, offset, pinfo, pres_tree, -1);
1461                         break;
1462                 case SES_RESYNCHRONIZE_ACK:
1463                         offset = dissect_pres_RSA_PPDU(FALSE, tvb, offset, pinfo, pres_tree, -1);
1464                         break;
1465                 case SES_REFUSE:
1466                         offset = dissect_pres_CPR_PPDU(FALSE, tvb, offset, pinfo, pres_tree, hf_pres_CPR_PPDU);
1467                         break;
1468                 default:
1469                         offset = dissect_pres_CPC_type(FALSE, tvb, offset, pinfo, pres_tree, hf_pres_user_data);
1470                         break;
1471         }
1472
1473         return offset;
1474 }
1475
1476 void
1477 dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
1478 {
1479         int offset = 0, old_offset;
1480 /* first, try to check length   */
1481 /* do we have at least 4 bytes  */
1482         if (!tvb_bytes_exist(tvb, 0, 4)){
1483                 proto_tree_add_text(parent_tree, tvb, offset, 
1484                         tvb_reported_length_remaining(tvb,offset),"User data");
1485                 return;  /* no, it isn't a presentation PDU */
1486         }
1487
1488         /*  we can't make any additional checking here   */
1489         /*  postpone it before dissector will have more information */
1490
1491         if (check_col(pinfo->cinfo, COL_PROTOCOL))
1492                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PRES");
1493         if (check_col(pinfo->cinfo, COL_INFO))
1494                 col_clear(pinfo->cinfo, COL_INFO);
1495         /* save pointers for calling the acse dissector  */
1496         global_tree = parent_tree;
1497         global_pinfo = pinfo;
1498
1499         while (tvb_reported_length_remaining(tvb, offset) > 0){
1500                 old_offset = offset;
1501                 offset = dissect_ppdu(tvb, offset, pinfo, parent_tree);
1502                 if(offset <= old_offset){
1503                         proto_tree_add_text(parent_tree, tvb, offset, -1,"Invalid offset");
1504                         THROW(ReportedBoundsError);
1505                 }
1506         }
1507 }
1508
1509
1510 /*--- proto_register_pres -------------------------------------------*/
1511 void proto_register_pres(void) {
1512
1513   /* List of fields */
1514   static hf_register_info hf[] = {
1515     { &hf_pres_CP_type,
1516       { "CP-type", "pres.cptype",
1517         FT_NONE, BASE_NONE, NULL, 0,
1518         "", HFILL }},
1519     { &hf_pres_CPA_PPDU,
1520       { "CPA-PPDU", "pres.cpapdu",
1521         FT_NONE, BASE_NONE, NULL, 0,
1522         "", HFILL }},
1523     { &hf_pres_Abort_type,
1524       { "Abort type", "pres.aborttype",
1525         FT_UINT32, BASE_DEC, VALS(pres_Abort_type_vals), 0,
1526         "", HFILL }},
1527     { &hf_pres_CPR_PPDU,
1528       { "CPR-PPDU", "pres.cprtype",
1529         FT_UINT32, BASE_DEC, VALS(pres_CPR_PPDU_vals), 0,
1530         "", HFILL }},
1531     { &hf_pres_Typed_data_type,
1532       { "Typed data type", "pres.Typed_data_type",
1533         FT_UINT32, BASE_DEC, VALS(pres_Typed_data_type_vals), 0,
1534         "", HFILL }},
1535
1536
1537
1538 /*--- Included file: packet-pres-hfarr.c ---*/
1539
1540     { &hf_pres_mode_selector,
1541       { "mode-selector", "pres.mode_selector",
1542         FT_NONE, BASE_NONE, NULL, 0,
1543         "", HFILL }},
1544     { &hf_pres_x410_mode_parameters,
1545       { "x410-mode-parameters", "pres.x410_mode_parameters",
1546         FT_NONE, BASE_NONE, NULL, 0,
1547         "CP-type/x410-mode-parameters", HFILL }},
1548     { &hf_pres_normal_mode_parameters,
1549       { "normal-mode-parameters", "pres.normal_mode_parameters",
1550         FT_NONE, BASE_NONE, NULL, 0,
1551         "CP-type/normal-mode-parameters", HFILL }},
1552     { &hf_pres_protocol_version,
1553       { "protocol-version", "pres.protocol_version",
1554         FT_BYTES, BASE_HEX, NULL, 0,
1555         "", HFILL }},
1556     { &hf_pres_calling_presentation_selector,
1557       { "calling-presentation-selector", "pres.calling_presentation_selector",
1558         FT_BYTES, BASE_HEX, NULL, 0,
1559         "CP-type/normal-mode-parameters/calling-presentation-selector", HFILL }},
1560     { &hf_pres_called_presentation_selector,
1561       { "called-presentation-selector", "pres.called_presentation_selector",
1562         FT_BYTES, BASE_HEX, NULL, 0,
1563         "CP-type/normal-mode-parameters/called-presentation-selector", HFILL }},
1564     { &hf_pres_presentation_context_definition_list,
1565       { "presentation-context-definition-list", "pres.presentation_context_definition_list",
1566         FT_UINT32, BASE_DEC, NULL, 0,
1567         "CP-type/normal-mode-parameters/presentation-context-definition-list", HFILL }},
1568     { &hf_pres_default_context_name,
1569       { "default-context-name", "pres.default_context_name",
1570         FT_NONE, BASE_NONE, NULL, 0,
1571         "CP-type/normal-mode-parameters/default-context-name", HFILL }},
1572     { &hf_pres_presentation_requirements,
1573       { "presentation-requirements", "pres.presentation_requirements",
1574         FT_BYTES, BASE_HEX, NULL, 0,
1575         "", HFILL }},
1576     { &hf_pres_user_session_requirements,
1577       { "user-session-requirements", "pres.user_session_requirements",
1578         FT_BYTES, BASE_HEX, NULL, 0,
1579         "", HFILL }},
1580     { &hf_pres_protocol_options,
1581       { "protocol-options", "pres.protocol_options",
1582         FT_BYTES, BASE_HEX, NULL, 0,
1583         "", HFILL }},
1584     { &hf_pres_initiators_nominated_context,
1585       { "initiators-nominated-context", "pres.initiators_nominated_context",
1586         FT_INT32, BASE_DEC, NULL, 0,
1587         "CP-type/normal-mode-parameters/initiators-nominated-context", HFILL }},
1588     { &hf_pres_extensions,
1589       { "extensions", "pres.extensions",
1590         FT_NONE, BASE_NONE, NULL, 0,
1591         "CP-type/normal-mode-parameters/extensions", HFILL }},
1592     { &hf_pres_user_data,
1593       { "user-data", "pres.user_data",
1594         FT_UINT32, BASE_DEC, VALS(pres_User_data_vals), 0,
1595         "", HFILL }},
1596     { &hf_pres_cPR_PPDU_x400_mode_parameters,
1597       { "x410-mode-parameters", "pres.x410_mode_parameters",
1598         FT_NONE, BASE_NONE, NULL, 0,
1599         "CPA-PPDU/x410-mode-parameters", HFILL }},
1600     { &hf_pres_cPU_PPDU_normal_mode_parameters,
1601       { "normal-mode-parameters", "pres.normal_mode_parameters",
1602         FT_NONE, BASE_NONE, NULL, 0,
1603         "CPA-PPDU/normal-mode-parameters", HFILL }},
1604     { &hf_pres_responding_presentation_selector,
1605       { "responding-presentation-selector", "pres.responding_presentation_selector",
1606         FT_BYTES, BASE_HEX, NULL, 0,
1607         "", HFILL }},
1608     { &hf_pres_presentation_context_definition_result_list,
1609       { "presentation-context-definition-result-list", "pres.presentation_context_definition_result_list",
1610         FT_UINT32, BASE_DEC, NULL, 0,
1611         "", HFILL }},
1612     { &hf_pres_responders_nominated_context,
1613       { "responders-nominated-context", "pres.responders_nominated_context",
1614         FT_INT32, BASE_DEC, NULL, 0,
1615         "CPA-PPDU/normal-mode-parameters/responders-nominated-context", HFILL }},
1616     { &hf_pres_cPU_PPDU_x400_mode_parameters,
1617       { "x400-mode-parameters", "pres.x400_mode_parameters",
1618         FT_NONE, BASE_NONE, NULL, 0,
1619         "CPR-PPDU/x400-mode-parameters", HFILL }},
1620     { &hf_pres_cPR_PPDU_normal_mode_parameters,
1621       { "normal-mode-parameters", "pres.normal_mode_parameters",
1622         FT_NONE, BASE_NONE, NULL, 0,
1623         "CPR-PPDU/normal-mode-parameters", HFILL }},
1624     { &hf_pres_default_context_result,
1625       { "default-context-result", "pres.default_context_result",
1626         FT_INT32, BASE_DEC, VALS(pres_Result_vals), 0,
1627         "CPR-PPDU/normal-mode-parameters/default-context-result", HFILL }},
1628     { &hf_pres_cPR_PPDU__provider_reason,
1629       { "provider-reason", "pres.provider_reason",
1630         FT_INT32, BASE_DEC, VALS(pres_Provider_reason_vals), 0,
1631         "CPR-PPDU/normal-mode-parameters/provider-reason", HFILL }},
1632     { &hf_pres_aru_ppdu,
1633       { "aru-ppdu", "pres.aru_ppdu",
1634         FT_UINT32, BASE_DEC, VALS(pres_ARU_PPDU_vals), 0,
1635         "Abort-type/aru-ppdu", HFILL }},
1636     { &hf_pres_arp_ppdu,
1637       { "arp-ppdu", "pres.arp_ppdu",
1638         FT_NONE, BASE_NONE, NULL, 0,
1639         "Abort-type/arp-ppdu", HFILL }},
1640     { &hf_pres_aRU_PPDU_x400_mode_parameters,
1641       { "x400-mode-parameters", "pres.x400_mode_parameters",
1642         FT_NONE, BASE_NONE, NULL, 0,
1643         "ARU-PPDU/x400-mode-parameters", HFILL }},
1644     { &hf_pres_aRU_PPDU_normal_mode_parameters,
1645       { "normal-mode-parameters", "pres.normal_mode_parameters",
1646         FT_NONE, BASE_NONE, NULL, 0,
1647         "ARU-PPDU/normal-mode-parameters", HFILL }},
1648     { &hf_pres_presentation_context_identifier_list,
1649       { "presentation-context-identifier-list", "pres.presentation_context_identifier_list",
1650         FT_UINT32, BASE_DEC, NULL, 0,
1651         "", HFILL }},
1652     { &hf_pres_aRU_PPDU_provider_reason,
1653       { "provider-reason", "pres.provider_reason",
1654         FT_INT32, BASE_DEC, VALS(pres_Abort_reason_vals), 0,
1655         "ARP-PPDU/provider-reason", HFILL }},
1656     { &hf_pres_event_identifier,
1657       { "event-identifier", "pres.event_identifier",
1658         FT_INT32, BASE_DEC, VALS(pres_Event_identifier_vals), 0,
1659         "ARP-PPDU/event-identifier", HFILL }},
1660     { &hf_pres_acPPDU,
1661       { "acPPDU", "pres.acPPDU",
1662         FT_NONE, BASE_NONE, NULL, 0,
1663         "Typed-data-type/acPPDU", HFILL }},
1664     { &hf_pres_acaPPDU,
1665       { "acaPPDU", "pres.acaPPDU",
1666         FT_NONE, BASE_NONE, NULL, 0,
1667         "Typed-data-type/acaPPDU", HFILL }},
1668     { &hf_pres_ttdPPDU,
1669       { "ttdPPDU", "pres.ttdPPDU",
1670         FT_UINT32, BASE_DEC, VALS(pres_User_data_vals), 0,
1671         "Typed-data-type/ttdPPDU", HFILL }},
1672     { &hf_pres_presentation_context_addition_list,
1673       { "presentation-context-addition-list", "pres.presentation_context_addition_list",
1674         FT_UINT32, BASE_DEC, NULL, 0,
1675         "AC-PPDU/presentation-context-addition-list", HFILL }},
1676     { &hf_pres_presentation_context_deletion_list,
1677       { "presentation-context-deletion-list", "pres.presentation_context_deletion_list",
1678         FT_UINT32, BASE_DEC, NULL, 0,
1679         "AC-PPDU/presentation-context-deletion-list", HFILL }},
1680     { &hf_pres_presentation_context_addition_result_list,
1681       { "presentation-context-addition-result-list", "pres.presentation_context_addition_result_list",
1682         FT_UINT32, BASE_DEC, NULL, 0,
1683         "ACA-PPDU/presentation-context-addition-result-list", HFILL }},
1684     { &hf_pres_presentation_context_deletion_result_list,
1685       { "presentation-context-deletion-result-list", "pres.presentation_context_deletion_result_list",
1686         FT_UINT32, BASE_DEC, NULL, 0,
1687         "ACA-PPDU/presentation-context-deletion-result-list", HFILL }},
1688     { &hf_pres_Context_list_item,
1689       { "Item", "pres.Context_list_item",
1690         FT_NONE, BASE_NONE, NULL, 0,
1691         "Context-list/_item", HFILL }},
1692     { &hf_pres_presentation_context_identifier,
1693       { "presentation-context-identifier", "pres.presentation_context_identifier",
1694         FT_INT32, BASE_DEC, NULL, 0,
1695         "", HFILL }},
1696     { &hf_pres_abstract_syntax_name,
1697       { "abstract-syntax-name", "pres.abstract_syntax_name",
1698         FT_STRING, BASE_NONE, NULL, 0,
1699         "", HFILL }},
1700     { &hf_pres_transfer_syntax_name_list,
1701       { "transfer-syntax-name-list", "pres.transfer_syntax_name_list",
1702         FT_UINT32, BASE_DEC, NULL, 0,
1703         "Context-list/_item/transfer-syntax-name-list", HFILL }},
1704     { &hf_pres_transfer_syntax_name_list_item,
1705       { "Item", "pres.transfer_syntax_name_list_item",
1706         FT_STRING, BASE_NONE, NULL, 0,
1707         "Context-list/_item/transfer-syntax-name-list/_item", HFILL }},
1708     { &hf_pres_transfer_syntax_name,
1709       { "transfer-syntax-name", "pres.transfer_syntax_name",
1710         FT_STRING, BASE_NONE, NULL, 0,
1711         "", HFILL }},
1712     { &hf_pres_mode_value,
1713       { "mode-value", "pres.mode_value",
1714         FT_INT32, BASE_DEC, VALS(pres_T_mode_value_vals), 0,
1715         "Mode-selector/mode-value", HFILL }},
1716     { &hf_pres_Presentation_context_deletion_list_item,
1717       { "Item", "pres.Presentation_context_deletion_list_item",
1718         FT_INT32, BASE_DEC, NULL, 0,
1719         "Presentation-context-deletion-list/_item", HFILL }},
1720     { &hf_pres_Presentation_context_deletion_result_list_item,
1721       { "Item", "pres.Presentation_context_deletion_result_list_item",
1722         FT_INT32, BASE_DEC, VALS(pres_Presentation_context_deletion_result_list_item_vals), 0,
1723         "Presentation-context-deletion-result-list/_item", HFILL }},
1724     { &hf_pres_Presentation_context_identifier_list_item,
1725       { "Item", "pres.Presentation_context_identifier_list_item",
1726         FT_NONE, BASE_NONE, NULL, 0,
1727         "Presentation-context-identifier-list/_item", HFILL }},
1728     { &hf_pres_Result_list_item,
1729       { "Item", "pres.Result_list_item",
1730         FT_NONE, BASE_NONE, NULL, 0,
1731         "Result-list/_item", HFILL }},
1732     { &hf_pres_result,
1733       { "result", "pres.result",
1734         FT_INT32, BASE_DEC, VALS(pres_Result_vals), 0,
1735         "Result-list/_item/result", HFILL }},
1736     { &hf_pres_provider_reason,
1737       { "provider-reason", "pres.provider_reason",
1738         FT_INT32, BASE_DEC, VALS(pres_T_provider_reason_vals), 0,
1739         "Result-list/_item/provider-reason", HFILL }},
1740     { &hf_pres_simply_encoded_data,
1741       { "simply-encoded-data", "pres.simply_encoded_data",
1742         FT_BYTES, BASE_HEX, NULL, 0,
1743         "User-data/simply-encoded-data", HFILL }},
1744     { &hf_pres_fully_encoded_data,
1745       { "fully-encoded-data", "pres.fully_encoded_data",
1746         FT_UINT32, BASE_DEC, NULL, 0,
1747         "User-data/fully-encoded-data", HFILL }},
1748     { &hf_pres_Fully_encoded_data_item,
1749       { "Item", "pres.Fully_encoded_data_item",
1750         FT_NONE, BASE_NONE, NULL, 0,
1751         "Fully-encoded-data/_item", HFILL }},
1752     { &hf_pres_presentation_data_values,
1753       { "presentation-data-values", "pres.presentation_data_values",
1754         FT_UINT32, BASE_DEC, VALS(pres_T_presentation_data_values_vals), 0,
1755         "PDV-list/presentation-data-values", HFILL }},
1756     { &hf_pres_single_ASN1_type,
1757       { "single-ASN1-type", "pres.single_ASN1_type",
1758         FT_BYTES, BASE_HEX, NULL, 0,
1759         "PDV-list/presentation-data-values/single-ASN1-type", HFILL }},
1760     { &hf_pres_octet_aligned,
1761       { "octet-aligned", "pres.octet_aligned",
1762         FT_BYTES, BASE_HEX, NULL, 0,
1763         "PDV-list/presentation-data-values/octet-aligned", HFILL }},
1764     { &hf_pres_arbitrary,
1765       { "arbitrary", "pres.arbitrary",
1766         FT_BYTES, BASE_HEX, NULL, 0,
1767         "PDV-list/presentation-data-values/arbitrary", HFILL }},
1768     { &hf_pres_Presentation_requirements_context_management,
1769       { "context-management", "pres.context-management",
1770         FT_BOOLEAN, 8, NULL, 0x80,
1771         "", HFILL }},
1772     { &hf_pres_Presentation_requirements_restoration,
1773       { "restoration", "pres.restoration",
1774         FT_BOOLEAN, 8, NULL, 0x40,
1775         "", HFILL }},
1776     { &hf_pres_Protocol_options_nominated_context,
1777       { "nominated-context", "pres.nominated-context",
1778         FT_BOOLEAN, 8, NULL, 0x80,
1779         "", HFILL }},
1780     { &hf_pres_Protocol_options_short_encoding,
1781       { "short-encoding", "pres.short-encoding",
1782         FT_BOOLEAN, 8, NULL, 0x40,
1783         "", HFILL }},
1784     { &hf_pres_Protocol_options_packed_encoding_rules,
1785       { "packed-encoding-rules", "pres.packed-encoding-rules",
1786         FT_BOOLEAN, 8, NULL, 0x20,
1787         "", HFILL }},
1788     { &hf_pres_Protocol_version_version_1,
1789       { "version-1", "pres.version-1",
1790         FT_BOOLEAN, 8, NULL, 0x80,
1791         "", HFILL }},
1792     { &hf_pres_User_session_requirements_half_duplex,
1793       { "half-duplex", "pres.half-duplex",
1794         FT_BOOLEAN, 8, NULL, 0x80,
1795         "", HFILL }},
1796     { &hf_pres_User_session_requirements_duplex,
1797       { "duplex", "pres.duplex",
1798         FT_BOOLEAN, 8, NULL, 0x40,
1799         "", HFILL }},
1800     { &hf_pres_User_session_requirements_expedited_data,
1801       { "expedited-data", "pres.expedited-data",
1802         FT_BOOLEAN, 8, NULL, 0x20,
1803         "", HFILL }},
1804     { &hf_pres_User_session_requirements_minor_synchronize,
1805       { "minor-synchronize", "pres.minor-synchronize",
1806         FT_BOOLEAN, 8, NULL, 0x10,
1807         "", HFILL }},
1808     { &hf_pres_User_session_requirements_major_synchronize,
1809       { "major-synchronize", "pres.major-synchronize",
1810         FT_BOOLEAN, 8, NULL, 0x08,
1811         "", HFILL }},
1812     { &hf_pres_User_session_requirements_resynchronize,
1813       { "resynchronize", "pres.resynchronize",
1814         FT_BOOLEAN, 8, NULL, 0x04,
1815         "", HFILL }},
1816     { &hf_pres_User_session_requirements_activity_management,
1817       { "activity-management", "pres.activity-management",
1818         FT_BOOLEAN, 8, NULL, 0x02,
1819         "", HFILL }},
1820     { &hf_pres_User_session_requirements_negotiated_release,
1821       { "negotiated-release", "pres.negotiated-release",
1822         FT_BOOLEAN, 8, NULL, 0x01,
1823         "", HFILL }},
1824     { &hf_pres_User_session_requirements_capability_data,
1825       { "capability-data", "pres.capability-data",
1826         FT_BOOLEAN, 8, NULL, 0x80,
1827         "", HFILL }},
1828     { &hf_pres_User_session_requirements_exceptions,
1829       { "exceptions", "pres.exceptions",
1830         FT_BOOLEAN, 8, NULL, 0x40,
1831         "", HFILL }},
1832     { &hf_pres_User_session_requirements_typed_data,
1833       { "typed-data", "pres.typed-data",
1834         FT_BOOLEAN, 8, NULL, 0x20,
1835         "", HFILL }},
1836     { &hf_pres_User_session_requirements_symmetric_synchronize,
1837       { "symmetric-synchronize", "pres.symmetric-synchronize",
1838         FT_BOOLEAN, 8, NULL, 0x10,
1839         "", HFILL }},
1840     { &hf_pres_User_session_requirements_data_separation,
1841       { "data-separation", "pres.data-separation",
1842         FT_BOOLEAN, 8, NULL, 0x08,
1843         "", HFILL }},
1844
1845 /*--- End of included file: packet-pres-hfarr.c ---*/
1846
1847   };
1848
1849   /* List of subtrees */
1850   static gint *ett[] = {
1851                 &ett_pres,
1852
1853 /*--- Included file: packet-pres-ettarr.c ---*/
1854
1855     &ett_pres_CP_type,
1856     &ett_pres_T_normal_mode_parameters,
1857     &ett_pres_T_extensions,
1858     &ett_pres_CPA_PPDU,
1859     &ett_pres_T_CPA_PPDU_normal_mode_parameters,
1860     &ett_pres_CPR_PPDU,
1861     &ett_pres_T_CPR_PPDU_normal_mode_parameters,
1862     &ett_pres_Abort_type,
1863     &ett_pres_ARU_PPDU,
1864     &ett_pres_T_ARU_PPDU_normal_mode_parameters,
1865     &ett_pres_ARP_PPDU,
1866     &ett_pres_Typed_data_type,
1867     &ett_pres_AC_PPDU,
1868     &ett_pres_ACA_PPDU,
1869     &ett_pres_RS_PPDU,
1870     &ett_pres_RSA_PPDU,
1871     &ett_pres_Context_list,
1872     &ett_pres_Context_list_item,
1873     &ett_pres_SEQUENCE_OF_Transfer_syntax_name,
1874     &ett_pres_Default_context_name,
1875     &ett_pres_Mode_selector,
1876     &ett_pres_Presentation_context_deletion_list,
1877     &ett_pres_Presentation_context_deletion_result_list,
1878     &ett_pres_Presentation_context_identifier_list,
1879     &ett_pres_Presentation_context_identifier_list_item,
1880     &ett_pres_Presentation_requirements,
1881     &ett_pres_Protocol_options,
1882     &ett_pres_Protocol_version,
1883     &ett_pres_Result_list,
1884     &ett_pres_Result_list_item,
1885     &ett_pres_User_data,
1886     &ett_pres_Fully_encoded_data,
1887     &ett_pres_PDV_list,
1888     &ett_pres_T_presentation_data_values,
1889     &ett_pres_User_session_requirements,
1890
1891 /*--- End of included file: packet-pres-ettarr.c ---*/
1892
1893   };
1894
1895   /* Register protocol */
1896   proto_pres = proto_register_protocol(PNAME, PSNAME, PFNAME);
1897   register_dissector("pres", dissect_pres, proto_pres);
1898   /* Register fields and subtrees */
1899   proto_register_field_array(proto_pres, hf, array_length(hf));
1900   proto_register_subtree_array(ett, array_length(ett));
1901   register_init_routine(pres_init);
1902
1903 }
1904
1905
1906 /*--- proto_reg_handoff_pres ---------------------------------------*/
1907 void proto_reg_handoff_pres(void) {
1908
1909 /*      register_ber_oid_dissector("0.4.0.0.1.1.1.1", dissect_pres, proto_pres, 
1910           "itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) abstractSyntax(1) pres(1) version1(1)"); */
1911
1912         data_handle = find_dissector("data");
1913
1914 }