epan/dissectors/pidl/ C99 drsuapi
[wireshark-sm.git] / epan / dissectors / packet-pres.c
blob52cb6a7a8fc0797674850bbd7e20ad7637a25b85
1 /* Do not modify this file. Changes will be overwritten. */
2 /* Generated automatically by the ASN.1 to Wireshark dissector compiler */
3 /* packet-pres.c */
4 /* asn2wrs.py -b -q -L -p pres -c ./pres.cnf -s ./packet-pres-template -D . -O ../.. ISO8823-PRESENTATION.asn ISO9576-PRESENTATION.asn */
6 /* packet-pres.c
7 * Routine to dissect ISO 8823 OSI Presentation Protocol packets
8 * Based on the dissector by
9 * Yuriy Sidelnikov <YSidelnikov@hotmail.com>
11 * Wireshark - Network traffic analyzer
12 * By Gerald Combs <gerald@wireshark.org>
13 * Copyright 1998 Gerald Combs
15 * SPDX-License-Identifier: GPL-2.0-or-later
18 #include "config.h"
20 #include <epan/packet.h>
21 #include <epan/exceptions.h>
22 #include <epan/prefs.h>
23 #include <epan/conversation.h>
24 #include <epan/expert.h>
25 #include <epan/uat.h>
26 #include <wsutil/array.h>
28 #include <epan/asn1.h>
29 #include <epan/oids.h>
30 #include "packet-ber.h"
31 #include "packet-ses.h"
32 #include "packet-pres.h"
33 #include "packet-rtse.h"
36 #define PNAME "ISO 8823 OSI Presentation Protocol"
37 #define PSNAME "PRES"
38 #define PFNAME "pres"
40 #define CLPNAME "ISO 9576-1 OSI Connectionless Presentation Protocol"
41 #define CLPSNAME "CLPRES"
42 #define CLPFNAME "clpres"
44 void proto_register_pres(void);
45 void proto_reg_handoff_pres(void);
47 /* Initialize the protocol and registered fields */
48 static int proto_pres;
50 /* Initialize the connectionless protocol */
51 static int proto_clpres;
53 /* pointers for acse dissector */
54 proto_tree *global_tree;
55 packet_info *global_pinfo;
57 static const char *abstract_syntax_name_oid;
58 static uint32_t presentation_context_identifier;
60 /* to keep track of presentation context identifiers and protocol-oids */
61 typedef struct _pres_ctx_oid_t {
62 uint32_t ctx_id;
63 char *oid;
64 uint32_t idx;
65 } pres_ctx_oid_t;
66 static wmem_map_t *pres_ctx_oid_table;
68 typedef struct _pres_user_t {
69 unsigned ctx_id;
70 char *oid;
71 } pres_user_t;
73 static pres_user_t *pres_users;
74 static unsigned num_pres_users;
76 static int hf_pres_CP_type;
77 static int hf_pres_CPA_PPDU;
78 static int hf_pres_Abort_type;
79 static int hf_pres_CPR_PPDU;
80 static int hf_pres_Typed_data_type;
82 static int hf_pres_UD_type_PDU; /* UD_type */
83 static int hf_pres_mode_selector; /* Mode_selector */
84 static int hf_pres_x410_mode_parameters; /* RTORQapdu */
85 static int hf_pres_normal_mode_parameters; /* T_normal_mode_parameters */
86 static int hf_pres_protocol_version; /* Protocol_version */
87 static int hf_pres_calling_presentation_selector; /* Calling_presentation_selector */
88 static int hf_pres_called_presentation_selector; /* Called_presentation_selector */
89 static int hf_pres_presentation_context_definition_list; /* Presentation_context_definition_list */
90 static int hf_pres_default_context_name; /* Default_context_name */
91 static int hf_pres_presentation_requirements; /* Presentation_requirements */
92 static int hf_pres_user_session_requirements; /* User_session_requirements */
93 static int hf_pres_protocol_options; /* Protocol_options */
94 static int hf_pres_initiators_nominated_context; /* Presentation_context_identifier */
95 static int hf_pres_extensions; /* T_extensions */
96 static int hf_pres_user_data; /* User_data */
97 static int hf_pres_cPR_PPDU_x400_mode_parameters; /* RTOACapdu */
98 static int hf_pres_cPU_PPDU_normal_mode_parameters; /* T_CPA_PPDU_normal_mode_parameters */
99 static int hf_pres_responding_presentation_selector; /* Responding_presentation_selector */
100 static int hf_pres_presentation_context_definition_result_list; /* Presentation_context_definition_result_list */
101 static int hf_pres_responders_nominated_context; /* Presentation_context_identifier */
102 static int hf_pres_cPU_PPDU_x400_mode_parameters; /* RTORJapdu */
103 static int hf_pres_cPR_PPDU_normal_mode_parameters; /* T_CPR_PPDU_normal_mode_parameters */
104 static int hf_pres_default_context_result; /* Default_context_result */
105 static int hf_pres_cPR_PPDU__provider_reason; /* Provider_reason */
106 static int hf_pres_aru_ppdu; /* ARU_PPDU */
107 static int hf_pres_arp_ppdu; /* ARP_PPDU */
108 static int hf_pres_aRU_PPDU_x400_mode_parameters; /* RTABapdu */
109 static int hf_pres_aRU_PPDU_normal_mode_parameters; /* T_ARU_PPDU_normal_mode_parameters */
110 static int hf_pres_presentation_context_identifier_list; /* Presentation_context_identifier_list */
111 static int hf_pres_aRU_PPDU_provider_reason; /* Abort_reason */
112 static int hf_pres_event_identifier; /* Event_identifier */
113 static int hf_pres_acPPDU; /* AC_PPDU */
114 static int hf_pres_acaPPDU; /* ACA_PPDU */
115 static int hf_pres_ttdPPDU; /* User_data */
116 static int hf_pres_presentation_context_addition_list; /* Presentation_context_addition_list */
117 static int hf_pres_presentation_context_deletion_list; /* Presentation_context_deletion_list */
118 static int hf_pres_presentation_context_addition_result_list; /* Presentation_context_addition_result_list */
119 static int hf_pres_presentation_context_deletion_result_list; /* Presentation_context_deletion_result_list */
120 static int hf_pres_Context_list_item; /* Context_list_item */
121 static int hf_pres_presentation_context_identifier; /* Presentation_context_identifier */
122 static int hf_pres_abstract_syntax_name; /* Abstract_syntax_name */
123 static int hf_pres_transfer_syntax_name_list; /* SEQUENCE_OF_Transfer_syntax_name */
124 static int hf_pres_transfer_syntax_name_list_item; /* Transfer_syntax_name */
125 static int hf_pres_transfer_syntax_name; /* Transfer_syntax_name */
126 static int hf_pres_mode_value; /* T_mode_value */
127 static int hf_pres_Presentation_context_deletion_list_item; /* Presentation_context_identifier */
128 static int hf_pres_Presentation_context_deletion_result_list_item; /* Presentation_context_deletion_result_list_item */
129 static int hf_pres_Presentation_context_identifier_list_item; /* Presentation_context_identifier_list_item */
130 static int hf_pres_Result_list_item; /* Result_list_item */
131 static int hf_pres_result; /* Result */
132 static int hf_pres_provider_reason; /* T_provider_reason */
133 static int hf_pres_simply_encoded_data; /* Simply_encoded_data */
134 static int hf_pres_fully_encoded_data; /* Fully_encoded_data */
135 static int hf_pres_Fully_encoded_data_item; /* PDV_list */
136 static int hf_pres_presentation_data_values; /* T_presentation_data_values */
137 static int hf_pres_single_ASN1_type; /* T_single_ASN1_type */
138 static int hf_pres_octet_aligned; /* T_octet_aligned */
139 static int hf_pres_arbitrary; /* BIT_STRING */
140 /* named bits */
141 static int hf_pres_Presentation_requirements_context_management;
142 static int hf_pres_Presentation_requirements_restoration;
143 static int hf_pres_Protocol_options_nominated_context;
144 static int hf_pres_Protocol_options_short_encoding;
145 static int hf_pres_Protocol_options_packed_encoding_rules;
146 static int hf_pres_Protocol_version_version_1;
147 static int hf_pres_User_session_requirements_half_duplex;
148 static int hf_pres_User_session_requirements_duplex;
149 static int hf_pres_User_session_requirements_expedited_data;
150 static int hf_pres_User_session_requirements_minor_synchronize;
151 static int hf_pres_User_session_requirements_major_synchronize;
152 static int hf_pres_User_session_requirements_resynchronize;
153 static int hf_pres_User_session_requirements_activity_management;
154 static int hf_pres_User_session_requirements_negotiated_release;
155 static int hf_pres_User_session_requirements_capability_data;
156 static int hf_pres_User_session_requirements_exceptions;
157 static int hf_pres_User_session_requirements_typed_data;
158 static int hf_pres_User_session_requirements_symmetric_synchronize;
159 static int hf_pres_User_session_requirements_data_separation;
161 /* Initialize the subtree pointers */
162 static int ett_pres;
164 static int ett_pres_CP_type;
165 static int ett_pres_T_normal_mode_parameters;
166 static int ett_pres_T_extensions;
167 static int ett_pres_CPA_PPDU;
168 static int ett_pres_T_CPA_PPDU_normal_mode_parameters;
169 static int ett_pres_CPR_PPDU;
170 static int ett_pres_T_CPR_PPDU_normal_mode_parameters;
171 static int ett_pres_Abort_type;
172 static int ett_pres_ARU_PPDU;
173 static int ett_pres_T_ARU_PPDU_normal_mode_parameters;
174 static int ett_pres_ARP_PPDU;
175 static int ett_pres_Typed_data_type;
176 static int ett_pres_AC_PPDU;
177 static int ett_pres_ACA_PPDU;
178 static int ett_pres_RS_PPDU;
179 static int ett_pres_RSA_PPDU;
180 static int ett_pres_Context_list;
181 static int ett_pres_Context_list_item;
182 static int ett_pres_SEQUENCE_OF_Transfer_syntax_name;
183 static int ett_pres_Default_context_name;
184 static int ett_pres_Mode_selector;
185 static int ett_pres_Presentation_context_deletion_list;
186 static int ett_pres_Presentation_context_deletion_result_list;
187 static int ett_pres_Presentation_context_identifier_list;
188 static int ett_pres_Presentation_context_identifier_list_item;
189 static int ett_pres_Presentation_requirements;
190 static int ett_pres_Protocol_options;
191 static int ett_pres_Protocol_version;
192 static int ett_pres_Result_list;
193 static int ett_pres_Result_list_item;
194 static int ett_pres_User_data;
195 static int ett_pres_Fully_encoded_data;
196 static int ett_pres_PDV_list;
197 static int ett_pres_T_presentation_data_values;
198 static int ett_pres_User_session_requirements;
199 static int ett_pres_UD_type;
201 static expert_field ei_pres_dissector_not_available;
202 static expert_field ei_pres_wrong_spdu_type;
203 static expert_field ei_pres_invalid_offset;
205 UAT_DEC_CB_DEF(pres_users, ctx_id, pres_user_t)
206 UAT_CSTRING_CB_DEF(pres_users, oid, pres_user_t)
208 static unsigned
209 pres_ctx_oid_hash(const void *k)
211 const pres_ctx_oid_t *pco=(const pres_ctx_oid_t *)k;
212 return pco->ctx_id;
215 static int
216 pres_ctx_oid_equal(const void *k1, const void *k2)
218 const pres_ctx_oid_t *pco1=(const pres_ctx_oid_t *)k1;
219 const pres_ctx_oid_t *pco2=(const pres_ctx_oid_t *)k2;
220 return (pco1->ctx_id==pco2->ctx_id && pco1->idx==pco2->idx);
223 static void
224 register_ctx_id_and_oid(packet_info *pinfo _U_, uint32_t idx, const char *oid)
226 pres_ctx_oid_t *pco, *tmppco;
227 conversation_t *conversation;
229 if (!oid) {
230 /* we did not get any oid name, malformed packet? */
231 return;
234 pco=wmem_new(wmem_file_scope(), pres_ctx_oid_t);
235 pco->ctx_id=idx;
236 pco->oid=wmem_strdup(wmem_file_scope(), oid);
237 conversation=find_conversation_pinfo(pinfo, 0);
238 if (conversation) {
239 pco->idx = conversation->conv_index;
240 } else {
241 pco->idx = 0;
244 /* if this ctx already exists, remove the old one first */
245 tmppco=(pres_ctx_oid_t *)wmem_map_lookup(pres_ctx_oid_table, pco);
246 if (tmppco) {
247 wmem_map_remove(pres_ctx_oid_table, tmppco);
249 wmem_map_insert(pres_ctx_oid_table, pco, pco);
252 static char *
253 find_oid_in_users_table(packet_info *pinfo, uint32_t ctx_id)
255 unsigned i;
257 for (i = 0; i < num_pres_users; i++) {
258 pres_user_t *u = &(pres_users[i]);
260 if (u->ctx_id == ctx_id) {
261 /* Register oid so other dissectors can find this connection */
262 register_ctx_id_and_oid(pinfo, u->ctx_id, u->oid);
263 return u->oid;
267 return NULL;
270 char *
271 find_oid_by_pres_ctx_id(packet_info *pinfo, uint32_t idx)
273 pres_ctx_oid_t pco, *tmppco;
274 conversation_t *conversation;
276 pco.ctx_id=idx;
277 conversation=find_conversation_pinfo(pinfo, 0);
278 if (conversation) {
279 pco.idx = conversation->conv_index;
280 } else {
281 pco.idx = 0;
284 tmppco=(pres_ctx_oid_t *)wmem_map_lookup(pres_ctx_oid_table, &pco);
285 if (tmppco) {
286 return tmppco->oid;
289 return find_oid_in_users_table(pinfo, idx);
292 static void *
293 pres_copy_cb(void *dest, const void *orig, size_t len _U_)
295 pres_user_t *u = (pres_user_t *)dest;
296 const pres_user_t *o = (const pres_user_t *)orig;
298 u->ctx_id = o->ctx_id;
299 u->oid = g_strdup(o->oid);
301 return dest;
304 static void
305 pres_free_cb(void *r)
307 pres_user_t *u = (pres_user_t *)r;
309 g_free(u->oid);
314 static const value_string pres_T_mode_value_vals[] = {
315 { 0, "x410-1984-mode" },
316 { 1, "normal-mode" },
317 { 0, NULL }
321 static int
322 dissect_pres_T_mode_value(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
323 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
324 NULL);
326 return offset;
330 static const ber_sequence_t Mode_selector_set[] = {
331 { &hf_pres_mode_value , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_pres_T_mode_value },
332 { NULL, 0, 0, 0, NULL }
335 static int
336 dissect_pres_Mode_selector(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
337 offset = dissect_ber_set(implicit_tag, actx, tree, tvb, offset,
338 Mode_selector_set, hf_index, ett_pres_Mode_selector);
340 return offset;
344 static int * const Protocol_version_bits[] = {
345 &hf_pres_Protocol_version_version_1,
346 NULL
349 static int
350 dissect_pres_Protocol_version(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
351 offset = dissect_ber_bitstring(implicit_tag, actx, tree, tvb, offset,
352 Protocol_version_bits, 1, hf_index, ett_pres_Protocol_version,
353 NULL);
355 return offset;
360 static int
361 dissect_pres_Presentation_selector(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
362 offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
363 NULL);
365 return offset;
370 static int
371 dissect_pres_Calling_presentation_selector(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
372 offset = dissect_pres_Presentation_selector(implicit_tag, tvb, offset, actx, tree, hf_index);
374 return offset;
379 static int
380 dissect_pres_Called_presentation_selector(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
381 offset = dissect_pres_Presentation_selector(implicit_tag, tvb, offset, actx, tree, hf_index);
383 return offset;
388 static int
389 dissect_pres_Presentation_context_identifier(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
390 const char *name;
391 char *oid;
392 struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE*)actx->private_data;
394 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
395 &presentation_context_identifier);
398 if(session)
399 session->pres_ctx_id = presentation_context_identifier;
401 oid = find_oid_by_pres_ctx_id(actx->pinfo, presentation_context_identifier);
403 if(oid && (name = oid_resolved_from_string(actx->pinfo->pool, oid))) {
404 proto_item_append_text(actx->created_item, " (%s)", name);
408 return offset;
413 static int
414 dissect_pres_Abstract_syntax_name(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
415 offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &abstract_syntax_name_oid);
417 return offset;
422 static int
423 dissect_pres_Transfer_syntax_name(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
424 offset = dissect_ber_object_identifier(implicit_tag, actx, tree, tvb, offset, hf_index, NULL);
426 return offset;
430 static const ber_sequence_t SEQUENCE_OF_Transfer_syntax_name_sequence_of[1] = {
431 { &hf_pres_transfer_syntax_name_list_item, BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_pres_Transfer_syntax_name },
434 static int
435 dissect_pres_SEQUENCE_OF_Transfer_syntax_name(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
436 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
437 SEQUENCE_OF_Transfer_syntax_name_sequence_of, hf_index, ett_pres_SEQUENCE_OF_Transfer_syntax_name);
439 return offset;
443 static const ber_sequence_t Context_list_item_sequence[] = {
444 { &hf_pres_presentation_context_identifier, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_pres_Presentation_context_identifier },
445 { &hf_pres_abstract_syntax_name, BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_pres_Abstract_syntax_name },
446 { &hf_pres_transfer_syntax_name_list, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_pres_SEQUENCE_OF_Transfer_syntax_name },
447 { NULL, 0, 0, 0, NULL }
450 static int
451 dissect_pres_Context_list_item(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
452 abstract_syntax_name_oid=NULL;
453 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
454 Context_list_item_sequence, hf_index, ett_pres_Context_list_item);
456 register_ctx_id_and_oid(actx->pinfo, presentation_context_identifier, abstract_syntax_name_oid);
457 return offset;
461 static const ber_sequence_t Context_list_sequence_of[1] = {
462 { &hf_pres_Context_list_item, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_pres_Context_list_item },
465 static int
466 dissect_pres_Context_list(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
467 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
468 Context_list_sequence_of, hf_index, ett_pres_Context_list);
470 return offset;
475 static int
476 dissect_pres_Presentation_context_definition_list(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
477 offset = dissect_pres_Context_list(implicit_tag, tvb, offset, actx, tree, hf_index);
479 return offset;
483 static const ber_sequence_t Default_context_name_sequence[] = {
484 { &hf_pres_abstract_syntax_name, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_pres_Abstract_syntax_name },
485 { &hf_pres_transfer_syntax_name, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_pres_Transfer_syntax_name },
486 { NULL, 0, 0, 0, NULL }
489 static int
490 dissect_pres_Default_context_name(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
491 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
492 Default_context_name_sequence, hf_index, ett_pres_Default_context_name);
494 return offset;
498 static int * const Presentation_requirements_bits[] = {
499 &hf_pres_Presentation_requirements_context_management,
500 &hf_pres_Presentation_requirements_restoration,
501 NULL
504 static int
505 dissect_pres_Presentation_requirements(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
506 offset = dissect_ber_bitstring(implicit_tag, actx, tree, tvb, offset,
507 Presentation_requirements_bits, 2, hf_index, ett_pres_Presentation_requirements,
508 NULL);
510 return offset;
514 static int * const User_session_requirements_bits[] = {
515 &hf_pres_User_session_requirements_half_duplex,
516 &hf_pres_User_session_requirements_duplex,
517 &hf_pres_User_session_requirements_expedited_data,
518 &hf_pres_User_session_requirements_minor_synchronize,
519 &hf_pres_User_session_requirements_major_synchronize,
520 &hf_pres_User_session_requirements_resynchronize,
521 &hf_pres_User_session_requirements_activity_management,
522 &hf_pres_User_session_requirements_negotiated_release,
523 &hf_pres_User_session_requirements_capability_data,
524 &hf_pres_User_session_requirements_exceptions,
525 &hf_pres_User_session_requirements_typed_data,
526 &hf_pres_User_session_requirements_symmetric_synchronize,
527 &hf_pres_User_session_requirements_data_separation,
528 NULL
531 static int
532 dissect_pres_User_session_requirements(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
533 offset = dissect_ber_bitstring(implicit_tag, actx, tree, tvb, offset,
534 User_session_requirements_bits, 13, hf_index, ett_pres_User_session_requirements,
535 NULL);
537 return offset;
541 static int * const Protocol_options_bits[] = {
542 &hf_pres_Protocol_options_nominated_context,
543 &hf_pres_Protocol_options_short_encoding,
544 &hf_pres_Protocol_options_packed_encoding_rules,
545 NULL
548 static int
549 dissect_pres_Protocol_options(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
550 offset = dissect_ber_bitstring(implicit_tag, actx, tree, tvb, offset,
551 Protocol_options_bits, 3, hf_index, ett_pres_Protocol_options,
552 NULL);
554 return offset;
558 static const ber_sequence_t T_extensions_sequence[] = {
559 { NULL, 0, 0, 0, NULL }
562 static int
563 dissect_pres_T_extensions(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
564 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
565 T_extensions_sequence, hf_index, ett_pres_T_extensions);
567 return offset;
572 static int
573 dissect_pres_Simply_encoded_data(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
574 offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
575 NULL);
577 return offset;
582 static int
583 dissect_pres_T_single_ASN1_type(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
585 tvbuff_t *next_tvb;
586 char *oid;
588 oid=find_oid_by_pres_ctx_id(actx->pinfo, presentation_context_identifier);
589 if(oid){
590 next_tvb = tvb_new_subset_remaining(tvb, offset);
591 call_ber_oid_callback(oid, next_tvb, offset, actx->pinfo, global_tree, actx->private_data);
592 } else {
593 proto_tree_add_expert(tree, actx->pinfo, &ei_pres_dissector_not_available,
594 tvb, offset, -1);
598 return offset;
603 static int
604 dissect_pres_T_octet_aligned(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
606 tvbuff_t *next_tvb;
607 char *oid;
609 oid=find_oid_by_pres_ctx_id(actx->pinfo, presentation_context_identifier);
610 if(oid){
611 dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index, &next_tvb);
612 call_ber_oid_callback(oid, next_tvb, offset, actx->pinfo, global_tree, actx->private_data);
613 } else {
614 proto_tree_add_expert(tree, actx->pinfo, &ei_pres_dissector_not_available,
615 tvb, offset, -1);
616 offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
617 NULL);
623 return offset;
628 static int
629 dissect_pres_BIT_STRING(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
630 offset = dissect_ber_bitstring(implicit_tag, actx, tree, tvb, offset,
631 NULL, 0, hf_index, -1,
632 NULL);
634 return offset;
638 static const value_string pres_T_presentation_data_values_vals[] = {
639 { 0, "single-ASN1-type" },
640 { 1, "octet-aligned" },
641 { 2, "arbitrary" },
642 { 0, NULL }
645 static const ber_choice_t T_presentation_data_values_choice[] = {
646 { 0, &hf_pres_single_ASN1_type, BER_CLASS_CON, 0, 0, dissect_pres_T_single_ASN1_type },
647 { 1, &hf_pres_octet_aligned , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_pres_T_octet_aligned },
648 { 2, &hf_pres_arbitrary , BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_pres_BIT_STRING },
649 { 0, NULL, 0, 0, 0, NULL }
652 static int
653 dissect_pres_T_presentation_data_values(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
654 offset = dissect_ber_choice(actx, tree, tvb, offset,
655 T_presentation_data_values_choice, hf_index, ett_pres_T_presentation_data_values,
656 NULL);
658 return offset;
662 static const ber_sequence_t PDV_list_sequence[] = {
663 { &hf_pres_transfer_syntax_name, BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_pres_Transfer_syntax_name },
664 { &hf_pres_presentation_context_identifier, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_pres_Presentation_context_identifier },
665 { &hf_pres_presentation_data_values, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_pres_T_presentation_data_values },
666 { NULL, 0, 0, 0, NULL }
669 static int
670 dissect_pres_PDV_list(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
671 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
672 PDV_list_sequence, hf_index, ett_pres_PDV_list);
674 return offset;
678 static const ber_sequence_t Fully_encoded_data_sequence_of[1] = {
679 { &hf_pres_Fully_encoded_data_item, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_pres_PDV_list },
682 static int
683 dissect_pres_Fully_encoded_data(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
684 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
685 Fully_encoded_data_sequence_of, hf_index, ett_pres_Fully_encoded_data);
687 return offset;
691 static const value_string pres_User_data_vals[] = {
692 { 0, "simply-encoded-data" },
693 { 1, "fully-encoded-data" },
694 { 0, NULL }
697 static const ber_choice_t User_data_choice[] = {
698 { 0, &hf_pres_simply_encoded_data, BER_CLASS_APP, 0, BER_FLAGS_IMPLTAG, dissect_pres_Simply_encoded_data },
699 { 1, &hf_pres_fully_encoded_data, BER_CLASS_APP, 1, BER_FLAGS_IMPLTAG, dissect_pres_Fully_encoded_data },
700 { 0, NULL, 0, 0, 0, NULL }
703 static int
704 dissect_pres_User_data(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
705 offset = dissect_ber_choice(actx, tree, tvb, offset,
706 User_data_choice, hf_index, ett_pres_User_data,
707 NULL);
709 return offset;
713 static const ber_sequence_t T_normal_mode_parameters_sequence[] = {
714 { &hf_pres_protocol_version, BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Protocol_version },
715 { &hf_pres_calling_presentation_selector, BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Calling_presentation_selector },
716 { &hf_pres_called_presentation_selector, BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Called_presentation_selector },
717 { &hf_pres_presentation_context_definition_list, BER_CLASS_CON, 4, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Presentation_context_definition_list },
718 { &hf_pres_default_context_name, BER_CLASS_CON, 6, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Default_context_name },
719 { &hf_pres_presentation_requirements, BER_CLASS_CON, 8, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Presentation_requirements },
720 { &hf_pres_user_session_requirements, BER_CLASS_CON, 9, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_User_session_requirements },
721 { &hf_pres_protocol_options, BER_CLASS_CON, 11, BER_FLAGS_OPTIONAL, dissect_pres_Protocol_options },
722 { &hf_pres_initiators_nominated_context, BER_CLASS_CON, 12, BER_FLAGS_OPTIONAL, dissect_pres_Presentation_context_identifier },
723 { &hf_pres_extensions , BER_CLASS_CON, 14, BER_FLAGS_OPTIONAL, dissect_pres_T_extensions },
724 { &hf_pres_user_data , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_pres_User_data },
725 { NULL, 0, 0, 0, NULL }
728 static int
729 dissect_pres_T_normal_mode_parameters(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
730 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
731 T_normal_mode_parameters_sequence, hf_index, ett_pres_T_normal_mode_parameters);
733 return offset;
737 static const ber_sequence_t CP_type_set[] = {
738 { &hf_pres_mode_selector , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_pres_Mode_selector },
739 { &hf_pres_x410_mode_parameters, BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_rtse_RTORQapdu },
740 { &hf_pres_normal_mode_parameters, BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_T_normal_mode_parameters },
741 { NULL, 0, 0, 0, NULL }
744 static int
745 dissect_pres_CP_type(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
746 offset = dissect_ber_set(implicit_tag, actx, tree, tvb, offset,
747 CP_type_set, hf_index, ett_pres_CP_type);
749 return offset;
754 static int
755 dissect_pres_CPC_type(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
756 offset = dissect_pres_User_data(implicit_tag, tvb, offset, actx, tree, hf_index);
758 return offset;
763 static int
764 dissect_pres_Responding_presentation_selector(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
765 offset = dissect_pres_Presentation_selector(implicit_tag, tvb, offset, actx, tree, hf_index);
767 return offset;
771 static const value_string pres_Result_vals[] = {
772 { 0, "acceptance" },
773 { 1, "user-rejection" },
774 { 2, "provider-rejection" },
775 { 0, NULL }
779 static int
780 dissect_pres_Result(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
781 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
782 NULL);
784 return offset;
788 static const value_string pres_T_provider_reason_vals[] = {
789 { 0, "reason-not-specified" },
790 { 1, "abstract-syntax-not-supported" },
791 { 2, "proposed-transfer-syntaxes-not-supported" },
792 { 3, "local-limit-on-DCS-exceeded" },
793 { 0, NULL }
797 static int
798 dissect_pres_T_provider_reason(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
799 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
800 NULL);
802 return offset;
806 static const ber_sequence_t Result_list_item_sequence[] = {
807 { &hf_pres_result , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_pres_Result },
808 { &hf_pres_transfer_syntax_name, BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Transfer_syntax_name },
809 { &hf_pres_provider_reason, BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_T_provider_reason },
810 { NULL, 0, 0, 0, NULL }
813 static int
814 dissect_pres_Result_list_item(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
815 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
816 Result_list_item_sequence, hf_index, ett_pres_Result_list_item);
818 return offset;
822 static const ber_sequence_t Result_list_sequence_of[1] = {
823 { &hf_pres_Result_list_item, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_pres_Result_list_item },
826 static int
827 dissect_pres_Result_list(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
828 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
829 Result_list_sequence_of, hf_index, ett_pres_Result_list);
831 return offset;
836 static int
837 dissect_pres_Presentation_context_definition_result_list(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
838 offset = dissect_pres_Result_list(implicit_tag, tvb, offset, actx, tree, hf_index);
840 return offset;
844 static const ber_sequence_t T_CPA_PPDU_normal_mode_parameters_sequence[] = {
845 { &hf_pres_protocol_version, BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Protocol_version },
846 { &hf_pres_responding_presentation_selector, BER_CLASS_CON, 3, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Responding_presentation_selector },
847 { &hf_pres_presentation_context_definition_result_list, BER_CLASS_CON, 5, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Presentation_context_definition_result_list },
848 { &hf_pres_presentation_requirements, BER_CLASS_CON, 8, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Presentation_requirements },
849 { &hf_pres_user_session_requirements, BER_CLASS_CON, 9, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_User_session_requirements },
850 { &hf_pres_protocol_options, BER_CLASS_CON, 11, BER_FLAGS_OPTIONAL, dissect_pres_Protocol_options },
851 { &hf_pres_responders_nominated_context, BER_CLASS_CON, 13, BER_FLAGS_OPTIONAL, dissect_pres_Presentation_context_identifier },
852 { &hf_pres_user_data , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_pres_User_data },
853 { NULL, 0, 0, 0, NULL }
856 static int
857 dissect_pres_T_CPA_PPDU_normal_mode_parameters(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
858 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
859 T_CPA_PPDU_normal_mode_parameters_sequence, hf_index, ett_pres_T_CPA_PPDU_normal_mode_parameters);
861 return offset;
865 static const ber_sequence_t CPA_PPDU_set[] = {
866 { &hf_pres_mode_selector , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_pres_Mode_selector },
867 { &hf_pres_cPR_PPDU_x400_mode_parameters, BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_rtse_RTOACapdu },
868 { &hf_pres_cPU_PPDU_normal_mode_parameters, BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_T_CPA_PPDU_normal_mode_parameters },
869 { NULL, 0, 0, 0, NULL }
872 static int
873 dissect_pres_CPA_PPDU(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
874 offset = dissect_ber_set(implicit_tag, actx, tree, tvb, offset,
875 CPA_PPDU_set, hf_index, ett_pres_CPA_PPDU);
877 return offset;
882 static int
883 dissect_pres_Default_context_result(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
884 offset = dissect_pres_Result(implicit_tag, tvb, offset, actx, tree, hf_index);
886 return offset;
890 static const value_string pres_Provider_reason_vals[] = {
891 { 0, "reason-not-specified" },
892 { 1, "temporary-congestion" },
893 { 2, "local-limit-exceeded" },
894 { 3, "called-presentation-address-unknown" },
895 { 4, "protocol-version-not-supported" },
896 { 5, "default-context-not-supported" },
897 { 6, "user-data-not-readable" },
898 { 7, "no-PSAP-available" },
899 { 0, NULL }
903 static int
904 dissect_pres_Provider_reason(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
905 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
906 NULL);
908 return offset;
912 static const ber_sequence_t T_CPR_PPDU_normal_mode_parameters_sequence[] = {
913 { &hf_pres_protocol_version, BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Protocol_version },
914 { &hf_pres_responding_presentation_selector, BER_CLASS_CON, 3, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Responding_presentation_selector },
915 { &hf_pres_presentation_context_definition_result_list, BER_CLASS_CON, 5, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Presentation_context_definition_result_list },
916 { &hf_pres_default_context_result, BER_CLASS_CON, 7, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Default_context_result },
917 { &hf_pres_cPR_PPDU__provider_reason, BER_CLASS_CON, 10, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Provider_reason },
918 { &hf_pres_user_data , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_pres_User_data },
919 { NULL, 0, 0, 0, NULL }
922 static int
923 dissect_pres_T_CPR_PPDU_normal_mode_parameters(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
924 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
925 T_CPR_PPDU_normal_mode_parameters_sequence, hf_index, ett_pres_T_CPR_PPDU_normal_mode_parameters);
927 return offset;
931 static const value_string pres_CPR_PPDU_vals[] = {
932 { 0, "x400-mode-parameters" },
933 { 1, "normal-mode-parameters" },
934 { 0, NULL }
937 static const ber_choice_t CPR_PPDU_choice[] = {
938 { 0, &hf_pres_cPU_PPDU_x400_mode_parameters, BER_CLASS_UNI, BER_UNI_TAG_SET, BER_FLAGS_NOOWNTAG, dissect_rtse_RTORJapdu },
939 { 1, &hf_pres_cPR_PPDU_normal_mode_parameters, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_pres_T_CPR_PPDU_normal_mode_parameters },
940 { 0, NULL, 0, 0, 0, NULL }
943 static int
944 dissect_pres_CPR_PPDU(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
945 offset = dissect_ber_choice(actx, tree, tvb, offset,
946 CPR_PPDU_choice, hf_index, ett_pres_CPR_PPDU,
947 NULL);
949 return offset;
953 static const ber_sequence_t Presentation_context_identifier_list_item_sequence[] = {
954 { &hf_pres_presentation_context_identifier, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_pres_Presentation_context_identifier },
955 { &hf_pres_transfer_syntax_name, BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_pres_Transfer_syntax_name },
956 { NULL, 0, 0, 0, NULL }
959 static int
960 dissect_pres_Presentation_context_identifier_list_item(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
961 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
962 Presentation_context_identifier_list_item_sequence, hf_index, ett_pres_Presentation_context_identifier_list_item);
964 return offset;
968 static const ber_sequence_t Presentation_context_identifier_list_sequence_of[1] = {
969 { &hf_pres_Presentation_context_identifier_list_item, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_pres_Presentation_context_identifier_list_item },
972 static int
973 dissect_pres_Presentation_context_identifier_list(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
974 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
975 Presentation_context_identifier_list_sequence_of, hf_index, ett_pres_Presentation_context_identifier_list);
977 return offset;
981 static const ber_sequence_t T_ARU_PPDU_normal_mode_parameters_sequence[] = {
982 { &hf_pres_presentation_context_identifier_list, BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Presentation_context_identifier_list },
983 { &hf_pres_user_data , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_pres_User_data },
984 { NULL, 0, 0, 0, NULL }
987 static int
988 dissect_pres_T_ARU_PPDU_normal_mode_parameters(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
989 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
990 T_ARU_PPDU_normal_mode_parameters_sequence, hf_index, ett_pres_T_ARU_PPDU_normal_mode_parameters);
992 return offset;
996 static const value_string pres_ARU_PPDU_vals[] = {
997 { 0, "x400-mode-parameters" },
998 { 1, "normal-mode-parameters" },
999 { 0, NULL }
1002 static const ber_choice_t ARU_PPDU_choice[] = {
1003 { 0, &hf_pres_aRU_PPDU_x400_mode_parameters, BER_CLASS_UNI, BER_UNI_TAG_SET, BER_FLAGS_NOOWNTAG, dissect_rtse_RTABapdu },
1004 { 1, &hf_pres_aRU_PPDU_normal_mode_parameters, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_pres_T_ARU_PPDU_normal_mode_parameters },
1005 { 0, NULL, 0, 0, 0, NULL }
1008 static int
1009 dissect_pres_ARU_PPDU(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1010 offset = dissect_ber_choice(actx, tree, tvb, offset,
1011 ARU_PPDU_choice, hf_index, ett_pres_ARU_PPDU,
1012 NULL);
1014 return offset;
1018 static const value_string pres_Abort_reason_vals[] = {
1019 { 0, "reason-not-specified" },
1020 { 1, "unrecognized-ppdu" },
1021 { 2, "unexpected-ppdu" },
1022 { 3, "unexpected-session-service-primitive" },
1023 { 4, "unrecognized-ppdu-parameter" },
1024 { 5, "unexpected-ppdu-parameter" },
1025 { 6, "invalid-ppdu-parameter-value" },
1026 { 0, NULL }
1030 static int
1031 dissect_pres_Abort_reason(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1032 uint32_t reason;
1034 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
1035 &reason);
1038 col_append_fstr(actx->pinfo->cinfo, COL_INFO, " (%s)", val_to_str(reason, pres_Abort_reason_vals, "unknown: %d"));
1041 return offset;
1045 static const value_string pres_Event_identifier_vals[] = {
1046 { 0, "cp-PPDU" },
1047 { 1, "cpa-PPDU" },
1048 { 2, "cpr-PPDU" },
1049 { 3, "aru-PPDU" },
1050 { 4, "arp-PPDU" },
1051 { 5, "ac-PPDU" },
1052 { 6, "aca-PPDU" },
1053 { 7, "td-PPDU" },
1054 { 8, "ttd-PPDU" },
1055 { 9, "te-PPDU" },
1056 { 10, "tc-PPDU" },
1057 { 11, "tcc-PPDU" },
1058 { 12, "rs-PPDU" },
1059 { 13, "rsa-PPDU" },
1060 { 14, "s-release-indication" },
1061 { 15, "s-release-confirm" },
1062 { 16, "s-token-give-indication" },
1063 { 17, "s-token-please-indication" },
1064 { 18, "s-control-give-indication" },
1065 { 19, "s-sync-minor-indication" },
1066 { 20, "s-sync-minor-confirm" },
1067 { 21, "s-sync-major-indication" },
1068 { 22, "s-sync-major-confirm" },
1069 { 23, "s-p-exception-report-indication" },
1070 { 24, "s-u-exception-report-indication" },
1071 { 25, "s-activity-start-indication" },
1072 { 26, "s-activity-resume-indication" },
1073 { 27, "s-activity-interrupt-indication" },
1074 { 28, "s-activity-interrupt-confirm" },
1075 { 29, "s-activity-discard-indication" },
1076 { 30, "s-activity-discard-confirm" },
1077 { 31, "s-activity-end-indication" },
1078 { 32, "s-activity-end-confirm" },
1079 { 0, NULL }
1083 static int
1084 dissect_pres_Event_identifier(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1085 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
1086 NULL);
1088 return offset;
1092 static const ber_sequence_t ARP_PPDU_sequence[] = {
1093 { &hf_pres_aRU_PPDU_provider_reason, BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Abort_reason },
1094 { &hf_pres_event_identifier, BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Event_identifier },
1095 { NULL, 0, 0, 0, NULL }
1098 static int
1099 dissect_pres_ARP_PPDU(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1100 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
1101 ARP_PPDU_sequence, hf_index, ett_pres_ARP_PPDU);
1103 return offset;
1107 static const value_string pres_Abort_type_vals[] = {
1108 { 0, "aru-ppdu" },
1109 { 1, "arp-ppdu" },
1110 { 0, NULL }
1113 static const ber_choice_t Abort_type_choice[] = {
1114 { 0, &hf_pres_aru_ppdu , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG, dissect_pres_ARU_PPDU },
1115 { 1, &hf_pres_arp_ppdu , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_pres_ARP_PPDU },
1116 { 0, NULL, 0, 0, 0, NULL }
1119 static int
1120 dissect_pres_Abort_type(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1121 offset = dissect_ber_choice(actx, tree, tvb, offset,
1122 Abort_type_choice, hf_index, ett_pres_Abort_type,
1123 NULL);
1125 return offset;
1130 static int
1131 dissect_pres_Presentation_context_addition_list(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1132 offset = dissect_pres_Context_list(implicit_tag, tvb, offset, actx, tree, hf_index);
1134 return offset;
1138 static const ber_sequence_t Presentation_context_deletion_list_sequence_of[1] = {
1139 { &hf_pres_Presentation_context_deletion_list_item, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_pres_Presentation_context_identifier },
1142 static int
1143 dissect_pres_Presentation_context_deletion_list(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1144 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
1145 Presentation_context_deletion_list_sequence_of, hf_index, ett_pres_Presentation_context_deletion_list);
1147 return offset;
1151 static const ber_sequence_t AC_PPDU_sequence[] = {
1152 { &hf_pres_presentation_context_addition_list, BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Presentation_context_addition_list },
1153 { &hf_pres_presentation_context_deletion_list, BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Presentation_context_deletion_list },
1154 { &hf_pres_user_data , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_pres_User_data },
1155 { NULL, 0, 0, 0, NULL }
1158 static int
1159 dissect_pres_AC_PPDU(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1160 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
1161 AC_PPDU_sequence, hf_index, ett_pres_AC_PPDU);
1163 return offset;
1168 static int
1169 dissect_pres_Presentation_context_addition_result_list(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1170 offset = dissect_pres_Result_list(implicit_tag, tvb, offset, actx, tree, hf_index);
1172 return offset;
1176 static const value_string pres_Presentation_context_deletion_result_list_item_vals[] = {
1177 { 0, "acceptance" },
1178 { 1, "user-rejection" },
1179 { 0, NULL }
1183 static int
1184 dissect_pres_Presentation_context_deletion_result_list_item(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1185 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
1186 NULL);
1188 return offset;
1192 static const ber_sequence_t Presentation_context_deletion_result_list_sequence_of[1] = {
1193 { &hf_pres_Presentation_context_deletion_result_list_item, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_pres_Presentation_context_deletion_result_list_item },
1196 static int
1197 dissect_pres_Presentation_context_deletion_result_list(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1198 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
1199 Presentation_context_deletion_result_list_sequence_of, hf_index, ett_pres_Presentation_context_deletion_result_list);
1201 return offset;
1205 static const ber_sequence_t ACA_PPDU_sequence[] = {
1206 { &hf_pres_presentation_context_addition_result_list, BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Presentation_context_addition_result_list },
1207 { &hf_pres_presentation_context_deletion_result_list, BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Presentation_context_deletion_result_list },
1208 { &hf_pres_user_data , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_pres_User_data },
1209 { NULL, 0, 0, 0, NULL }
1212 static int
1213 dissect_pres_ACA_PPDU(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1214 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
1215 ACA_PPDU_sequence, hf_index, ett_pres_ACA_PPDU);
1217 return offset;
1221 static const value_string pres_Typed_data_type_vals[] = {
1222 { 0, "acPPDU" },
1223 { 1, "acaPPDU" },
1224 { 2, "ttdPPDU" },
1225 { 0, NULL }
1228 static const ber_choice_t Typed_data_type_choice[] = {
1229 { 0, &hf_pres_acPPDU , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_pres_AC_PPDU },
1230 { 1, &hf_pres_acaPPDU , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_pres_ACA_PPDU },
1231 { 2, &hf_pres_ttdPPDU , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG, dissect_pres_User_data },
1232 { 0, NULL, 0, 0, 0, NULL }
1235 static int
1236 dissect_pres_Typed_data_type(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1237 offset = dissect_ber_choice(actx, tree, tvb, offset,
1238 Typed_data_type_choice, hf_index, ett_pres_Typed_data_type,
1239 NULL);
1241 return offset;
1245 static const ber_sequence_t RS_PPDU_sequence[] = {
1246 { &hf_pres_presentation_context_identifier_list, BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Presentation_context_identifier_list },
1247 { &hf_pres_user_data , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_pres_User_data },
1248 { NULL, 0, 0, 0, NULL }
1251 static int
1252 dissect_pres_RS_PPDU(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1253 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
1254 RS_PPDU_sequence, hf_index, ett_pres_RS_PPDU);
1256 return offset;
1260 static const ber_sequence_t RSA_PPDU_sequence[] = {
1261 { &hf_pres_presentation_context_identifier_list, BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Presentation_context_identifier_list },
1262 { &hf_pres_user_data , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_pres_User_data },
1263 { NULL, 0, 0, 0, NULL }
1266 static int
1267 dissect_pres_RSA_PPDU(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1268 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
1269 RSA_PPDU_sequence, hf_index, ett_pres_RSA_PPDU);
1271 return offset;
1275 static const ber_sequence_t UD_type_sequence[] = {
1276 { &hf_pres_protocol_version, BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Protocol_version },
1277 { &hf_pres_calling_presentation_selector, BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Calling_presentation_selector },
1278 { &hf_pres_called_presentation_selector, BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Called_presentation_selector },
1279 { &hf_pres_presentation_context_definition_list, BER_CLASS_CON, 4, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pres_Presentation_context_definition_list },
1280 { &hf_pres_user_data , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_pres_User_data },
1281 { NULL, 0, 0, 0, NULL }
1284 static int
1285 dissect_pres_UD_type(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1286 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
1287 UD_type_sequence, hf_index, ett_pres_UD_type);
1289 return offset;
1293 /*--- PDUs ---*/
1295 static int dissect_UD_type_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
1296 int offset = 0;
1297 asn1_ctx_t asn1_ctx;
1298 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
1299 offset = dissect_pres_UD_type(false, tvb, offset, &asn1_ctx, tree, hf_pres_UD_type_PDU);
1300 return offset;
1306 * Dissect an PPDU.
1308 static int
1309 dissect_ppdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, struct SESSION_DATA_STRUCTURE* local_session)
1311 proto_item *ti;
1312 proto_tree *pres_tree;
1313 struct SESSION_DATA_STRUCTURE* session;
1314 asn1_ctx_t asn1_ctx;
1315 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
1317 /* do we have spdu type from the session dissector? */
1318 if (local_session == NULL) {
1319 proto_tree_add_expert(tree, pinfo, &ei_pres_wrong_spdu_type, tvb, offset, -1);
1320 return 0;
1323 session = local_session;
1324 if (session->spdu_type == 0) {
1325 proto_tree_add_expert_format(tree, pinfo, &ei_pres_wrong_spdu_type, tvb, offset, -1,
1326 "Internal error:wrong spdu type %x from session dissector.",session->spdu_type);
1327 return 0;
1330 /* set up type of PPDU */
1331 col_add_str(pinfo->cinfo, COL_INFO,
1332 val_to_str_ext(session->spdu_type, &ses_vals_ext, "Unknown PPDU type (0x%02x)"));
1334 asn1_ctx.private_data = session;
1336 ti = proto_tree_add_item(tree, proto_pres, tvb, offset, -1, ENC_NA);
1337 pres_tree = proto_item_add_subtree(ti, ett_pres);
1339 switch (session->spdu_type) {
1340 case SES_CONNECTION_REQUEST:
1341 offset = dissect_pres_CP_type(false, tvb, offset, &asn1_ctx, pres_tree, hf_pres_CP_type);
1342 break;
1343 case SES_CONNECTION_ACCEPT:
1344 offset = dissect_pres_CPA_PPDU(false, tvb, offset, &asn1_ctx, pres_tree, hf_pres_CPA_PPDU);
1345 break;
1346 case SES_ABORT:
1347 case SES_ABORT_ACCEPT:
1348 offset = dissect_pres_Abort_type(false, tvb, offset, &asn1_ctx, pres_tree, hf_pres_Abort_type);
1349 break;
1350 case SES_DATA_TRANSFER:
1351 offset = dissect_pres_CPC_type(false, tvb, offset, &asn1_ctx, pres_tree, hf_pres_user_data);
1352 break;
1353 case SES_TYPED_DATA:
1354 offset = dissect_pres_Typed_data_type(false, tvb, offset, &asn1_ctx, pres_tree, hf_pres_Typed_data_type);
1355 break;
1356 case SES_RESYNCHRONIZE:
1357 offset = dissect_pres_RS_PPDU(false, tvb, offset, &asn1_ctx, pres_tree, -1);
1358 break;
1359 case SES_RESYNCHRONIZE_ACK:
1360 offset = dissect_pres_RSA_PPDU(false, tvb, offset, &asn1_ctx, pres_tree, -1);
1361 break;
1362 case SES_REFUSE:
1363 offset = dissect_pres_CPR_PPDU(false, tvb, offset, &asn1_ctx, pres_tree, hf_pres_CPR_PPDU);
1364 break;
1365 default:
1366 offset = dissect_pres_CPC_type(false, tvb, offset, &asn1_ctx, pres_tree, hf_pres_user_data);
1367 break;
1370 return offset;
1373 static int
1374 dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data)
1376 int offset = 0, old_offset;
1377 struct SESSION_DATA_STRUCTURE* session;
1379 session = ((struct SESSION_DATA_STRUCTURE*)data);
1381 /* first, try to check length */
1382 /* do we have at least 4 bytes */
1383 if (!tvb_bytes_exist(tvb, 0, 4)) {
1384 if (session && session->spdu_type != SES_MAJOR_SYNC_POINT) {
1385 proto_tree_add_item(parent_tree, hf_pres_user_data, tvb, offset,
1386 tvb_reported_length_remaining(tvb,offset), ENC_NA);
1387 return 0; /* no, it isn't a presentation PDU */
1391 /* save pointers for calling the acse dissector */
1392 global_tree = parent_tree;
1393 global_pinfo = pinfo;
1395 /* if the session unit-data packet then we process it */
1396 /* as a connectionless presentation protocol unit data */
1397 if (session && session->spdu_type == CLSES_UNIT_DATA) {
1398 proto_tree * clpres_tree = NULL;
1399 proto_item *ti;
1401 col_set_str(pinfo->cinfo, COL_PROTOCOL, "CL-PRES");
1402 col_clear(pinfo->cinfo, COL_INFO);
1404 if (parent_tree) {
1405 ti = proto_tree_add_item(parent_tree, proto_clpres, tvb, offset, -1, ENC_NA);
1406 clpres_tree = proto_item_add_subtree(ti, ett_pres);
1409 /* dissect the packet */
1410 dissect_UD_type_PDU(tvb, pinfo, clpres_tree, NULL);
1411 return tvb_captured_length(tvb);
1414 /* we can't make any additional checking here */
1415 /* postpone it before dissector will have more information */
1417 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PRES");
1418 col_clear(pinfo->cinfo, COL_INFO);
1420 if (session && session->spdu_type == SES_MAJOR_SYNC_POINT) {
1421 /* This is a reassembly initiated in packet-ses */
1422 char *oid = find_oid_by_pres_ctx_id (pinfo, session->pres_ctx_id);
1423 if (oid) {
1424 call_ber_oid_callback (oid, tvb, offset, pinfo, parent_tree, session);
1425 } else {
1426 proto_tree_add_item(parent_tree, hf_pres_user_data, tvb, offset,
1427 tvb_reported_length_remaining(tvb,offset), ENC_NA);
1429 return tvb_captured_length(tvb);
1432 while (tvb_reported_length_remaining(tvb, offset) > 0) {
1433 old_offset = offset;
1434 offset = dissect_ppdu(tvb, offset, pinfo, parent_tree, session);
1435 if (offset <= old_offset) {
1436 proto_tree_add_expert(parent_tree, pinfo, &ei_pres_invalid_offset, tvb, offset, -1);
1437 break;
1441 return tvb_captured_length(tvb);
1445 /*--- proto_register_pres -------------------------------------------*/
1446 void proto_register_pres(void) {
1448 /* List of fields */
1449 static hf_register_info hf[] = {
1450 { &hf_pres_CP_type,
1451 { "CP-type", "pres.cptype",
1452 FT_NONE, BASE_NONE, NULL, 0,
1453 NULL, HFILL }},
1454 { &hf_pres_CPA_PPDU,
1455 { "CPA-PPDU", "pres.cpapdu",
1456 FT_NONE, BASE_NONE, NULL, 0,
1457 NULL, HFILL }},
1458 { &hf_pres_Abort_type,
1459 { "Abort type", "pres.aborttype",
1460 FT_UINT32, BASE_DEC, VALS(pres_Abort_type_vals), 0,
1461 NULL, HFILL }},
1462 { &hf_pres_CPR_PPDU,
1463 { "CPR-PPDU", "pres.cprtype",
1464 FT_UINT32, BASE_DEC, VALS(pres_CPR_PPDU_vals), 0,
1465 NULL, HFILL }},
1466 { &hf_pres_Typed_data_type,
1467 { "Typed data type", "pres.Typed_data_type",
1468 FT_UINT32, BASE_DEC, VALS(pres_Typed_data_type_vals), 0,
1469 NULL, HFILL }},
1471 { &hf_pres_UD_type_PDU,
1472 { "UD-type", "pres.UD_type_element",
1473 FT_NONE, BASE_NONE, NULL, 0,
1474 NULL, HFILL }},
1475 { &hf_pres_mode_selector,
1476 { "mode-selector", "pres.mode_selector_element",
1477 FT_NONE, BASE_NONE, NULL, 0,
1478 NULL, HFILL }},
1479 { &hf_pres_x410_mode_parameters,
1480 { "x410-mode-parameters", "pres.x410_mode_parameters_element",
1481 FT_NONE, BASE_NONE, NULL, 0,
1482 "RTORQapdu", HFILL }},
1483 { &hf_pres_normal_mode_parameters,
1484 { "normal-mode-parameters", "pres.normal_mode_parameters_element",
1485 FT_NONE, BASE_NONE, NULL, 0,
1486 NULL, HFILL }},
1487 { &hf_pres_protocol_version,
1488 { "protocol-version", "pres.protocol_version",
1489 FT_BYTES, BASE_NONE, NULL, 0,
1490 NULL, HFILL }},
1491 { &hf_pres_calling_presentation_selector,
1492 { "calling-presentation-selector", "pres.calling_presentation_selector",
1493 FT_BYTES, BASE_NONE, NULL, 0,
1494 NULL, HFILL }},
1495 { &hf_pres_called_presentation_selector,
1496 { "called-presentation-selector", "pres.called_presentation_selector",
1497 FT_BYTES, BASE_NONE, NULL, 0,
1498 NULL, HFILL }},
1499 { &hf_pres_presentation_context_definition_list,
1500 { "presentation-context-definition-list", "pres.presentation_context_definition_list",
1501 FT_UINT32, BASE_DEC, NULL, 0,
1502 NULL, HFILL }},
1503 { &hf_pres_default_context_name,
1504 { "default-context-name", "pres.default_context_name_element",
1505 FT_NONE, BASE_NONE, NULL, 0,
1506 NULL, HFILL }},
1507 { &hf_pres_presentation_requirements,
1508 { "presentation-requirements", "pres.presentation_requirements",
1509 FT_BYTES, BASE_NONE, NULL, 0,
1510 NULL, HFILL }},
1511 { &hf_pres_user_session_requirements,
1512 { "user-session-requirements", "pres.user_session_requirements",
1513 FT_BYTES, BASE_NONE, NULL, 0,
1514 NULL, HFILL }},
1515 { &hf_pres_protocol_options,
1516 { "protocol-options", "pres.protocol_options",
1517 FT_BYTES, BASE_NONE, NULL, 0,
1518 NULL, HFILL }},
1519 { &hf_pres_initiators_nominated_context,
1520 { "initiators-nominated-context", "pres.initiators_nominated_context",
1521 FT_INT32, BASE_DEC, NULL, 0,
1522 "Presentation_context_identifier", HFILL }},
1523 { &hf_pres_extensions,
1524 { "extensions", "pres.extensions_element",
1525 FT_NONE, BASE_NONE, NULL, 0,
1526 NULL, HFILL }},
1527 { &hf_pres_user_data,
1528 { "user-data", "pres.user_data",
1529 FT_UINT32, BASE_DEC, VALS(pres_User_data_vals), 0,
1530 NULL, HFILL }},
1531 { &hf_pres_cPR_PPDU_x400_mode_parameters,
1532 { "x410-mode-parameters", "pres.x410_mode_parameters_element",
1533 FT_NONE, BASE_NONE, NULL, 0,
1534 "RTOACapdu", HFILL }},
1535 { &hf_pres_cPU_PPDU_normal_mode_parameters,
1536 { "normal-mode-parameters", "pres.normal_mode_parameters_element",
1537 FT_NONE, BASE_NONE, NULL, 0,
1538 "T_CPA_PPDU_normal_mode_parameters", HFILL }},
1539 { &hf_pres_responding_presentation_selector,
1540 { "responding-presentation-selector", "pres.responding_presentation_selector",
1541 FT_BYTES, BASE_NONE, NULL, 0,
1542 NULL, HFILL }},
1543 { &hf_pres_presentation_context_definition_result_list,
1544 { "presentation-context-definition-result-list", "pres.presentation_context_definition_result_list",
1545 FT_UINT32, BASE_DEC, NULL, 0,
1546 NULL, HFILL }},
1547 { &hf_pres_responders_nominated_context,
1548 { "responders-nominated-context", "pres.responders_nominated_context",
1549 FT_INT32, BASE_DEC, NULL, 0,
1550 "Presentation_context_identifier", HFILL }},
1551 { &hf_pres_cPU_PPDU_x400_mode_parameters,
1552 { "x400-mode-parameters", "pres.x400_mode_parameters_element",
1553 FT_NONE, BASE_NONE, NULL, 0,
1554 "RTORJapdu", HFILL }},
1555 { &hf_pres_cPR_PPDU_normal_mode_parameters,
1556 { "normal-mode-parameters", "pres.normal_mode_parameters_element",
1557 FT_NONE, BASE_NONE, NULL, 0,
1558 "T_CPR_PPDU_normal_mode_parameters", HFILL }},
1559 { &hf_pres_default_context_result,
1560 { "default-context-result", "pres.default_context_result",
1561 FT_INT32, BASE_DEC, VALS(pres_Result_vals), 0,
1562 NULL, HFILL }},
1563 { &hf_pres_cPR_PPDU__provider_reason,
1564 { "provider-reason", "pres.provider_reason",
1565 FT_INT32, BASE_DEC, VALS(pres_Provider_reason_vals), 0,
1566 NULL, HFILL }},
1567 { &hf_pres_aru_ppdu,
1568 { "aru-ppdu", "pres.aru_ppdu",
1569 FT_UINT32, BASE_DEC, VALS(pres_ARU_PPDU_vals), 0,
1570 NULL, HFILL }},
1571 { &hf_pres_arp_ppdu,
1572 { "arp-ppdu", "pres.arp_ppdu_element",
1573 FT_NONE, BASE_NONE, NULL, 0,
1574 NULL, HFILL }},
1575 { &hf_pres_aRU_PPDU_x400_mode_parameters,
1576 { "x400-mode-parameters", "pres.x400_mode_parameters_element",
1577 FT_NONE, BASE_NONE, NULL, 0,
1578 "RTABapdu", HFILL }},
1579 { &hf_pres_aRU_PPDU_normal_mode_parameters,
1580 { "normal-mode-parameters", "pres.normal_mode_parameters_element",
1581 FT_NONE, BASE_NONE, NULL, 0,
1582 "T_ARU_PPDU_normal_mode_parameters", HFILL }},
1583 { &hf_pres_presentation_context_identifier_list,
1584 { "presentation-context-identifier-list", "pres.presentation_context_identifier_list",
1585 FT_UINT32, BASE_DEC, NULL, 0,
1586 NULL, HFILL }},
1587 { &hf_pres_aRU_PPDU_provider_reason,
1588 { "provider-reason", "pres.provider_reason",
1589 FT_INT32, BASE_DEC, VALS(pres_Abort_reason_vals), 0,
1590 "Abort_reason", HFILL }},
1591 { &hf_pres_event_identifier,
1592 { "event-identifier", "pres.event_identifier",
1593 FT_INT32, BASE_DEC, VALS(pres_Event_identifier_vals), 0,
1594 NULL, HFILL }},
1595 { &hf_pres_acPPDU,
1596 { "acPPDU", "pres.acPPDU_element",
1597 FT_NONE, BASE_NONE, NULL, 0,
1598 "AC_PPDU", HFILL }},
1599 { &hf_pres_acaPPDU,
1600 { "acaPPDU", "pres.acaPPDU_element",
1601 FT_NONE, BASE_NONE, NULL, 0,
1602 "ACA_PPDU", HFILL }},
1603 { &hf_pres_ttdPPDU,
1604 { "ttdPPDU", "pres.ttdPPDU",
1605 FT_UINT32, BASE_DEC, VALS(pres_User_data_vals), 0,
1606 "User_data", HFILL }},
1607 { &hf_pres_presentation_context_addition_list,
1608 { "presentation-context-addition-list", "pres.presentation_context_addition_list",
1609 FT_UINT32, BASE_DEC, NULL, 0,
1610 NULL, HFILL }},
1611 { &hf_pres_presentation_context_deletion_list,
1612 { "presentation-context-deletion-list", "pres.presentation_context_deletion_list",
1613 FT_UINT32, BASE_DEC, NULL, 0,
1614 NULL, HFILL }},
1615 { &hf_pres_presentation_context_addition_result_list,
1616 { "presentation-context-addition-result-list", "pres.presentation_context_addition_result_list",
1617 FT_UINT32, BASE_DEC, NULL, 0,
1618 NULL, HFILL }},
1619 { &hf_pres_presentation_context_deletion_result_list,
1620 { "presentation-context-deletion-result-list", "pres.presentation_context_deletion_result_list",
1621 FT_UINT32, BASE_DEC, NULL, 0,
1622 NULL, HFILL }},
1623 { &hf_pres_Context_list_item,
1624 { "Context-list item", "pres.Context_list_item_element",
1625 FT_NONE, BASE_NONE, NULL, 0,
1626 NULL, HFILL }},
1627 { &hf_pres_presentation_context_identifier,
1628 { "presentation-context-identifier", "pres.presentation_context_identifier",
1629 FT_INT32, BASE_DEC, NULL, 0,
1630 NULL, HFILL }},
1631 { &hf_pres_abstract_syntax_name,
1632 { "abstract-syntax-name", "pres.abstract_syntax_name",
1633 FT_OID, BASE_NONE, NULL, 0,
1634 NULL, HFILL }},
1635 { &hf_pres_transfer_syntax_name_list,
1636 { "transfer-syntax-name-list", "pres.transfer_syntax_name_list",
1637 FT_UINT32, BASE_DEC, NULL, 0,
1638 "SEQUENCE_OF_Transfer_syntax_name", HFILL }},
1639 { &hf_pres_transfer_syntax_name_list_item,
1640 { "Transfer-syntax-name", "pres.Transfer_syntax_name",
1641 FT_OID, BASE_NONE, NULL, 0,
1642 NULL, HFILL }},
1643 { &hf_pres_transfer_syntax_name,
1644 { "transfer-syntax-name", "pres.transfer_syntax_name",
1645 FT_OID, BASE_NONE, NULL, 0,
1646 NULL, HFILL }},
1647 { &hf_pres_mode_value,
1648 { "mode-value", "pres.mode_value",
1649 FT_INT32, BASE_DEC, VALS(pres_T_mode_value_vals), 0,
1650 NULL, HFILL }},
1651 { &hf_pres_Presentation_context_deletion_list_item,
1652 { "Presentation-context-identifier", "pres.Presentation_context_identifier",
1653 FT_INT32, BASE_DEC, NULL, 0,
1654 NULL, HFILL }},
1655 { &hf_pres_Presentation_context_deletion_result_list_item,
1656 { "Presentation-context-deletion-result-list item", "pres.Presentation_context_deletion_result_list_item",
1657 FT_INT32, BASE_DEC, VALS(pres_Presentation_context_deletion_result_list_item_vals), 0,
1658 NULL, HFILL }},
1659 { &hf_pres_Presentation_context_identifier_list_item,
1660 { "Presentation-context-identifier-list item", "pres.Presentation_context_identifier_list_item_element",
1661 FT_NONE, BASE_NONE, NULL, 0,
1662 NULL, HFILL }},
1663 { &hf_pres_Result_list_item,
1664 { "Result-list item", "pres.Result_list_item_element",
1665 FT_NONE, BASE_NONE, NULL, 0,
1666 NULL, HFILL }},
1667 { &hf_pres_result,
1668 { "result", "pres.result",
1669 FT_INT32, BASE_DEC, VALS(pres_Result_vals), 0,
1670 NULL, HFILL }},
1671 { &hf_pres_provider_reason,
1672 { "provider-reason", "pres.provider_reason",
1673 FT_INT32, BASE_DEC, VALS(pres_T_provider_reason_vals), 0,
1674 NULL, HFILL }},
1675 { &hf_pres_simply_encoded_data,
1676 { "simply-encoded-data", "pres.simply_encoded_data",
1677 FT_BYTES, BASE_NONE, NULL, 0,
1678 NULL, HFILL }},
1679 { &hf_pres_fully_encoded_data,
1680 { "fully-encoded-data", "pres.fully_encoded_data",
1681 FT_UINT32, BASE_DEC, NULL, 0,
1682 NULL, HFILL }},
1683 { &hf_pres_Fully_encoded_data_item,
1684 { "PDV-list", "pres.PDV_list_element",
1685 FT_NONE, BASE_NONE, NULL, 0,
1686 NULL, HFILL }},
1687 { &hf_pres_presentation_data_values,
1688 { "presentation-data-values", "pres.presentation_data_values",
1689 FT_UINT32, BASE_DEC, VALS(pres_T_presentation_data_values_vals), 0,
1690 NULL, HFILL }},
1691 { &hf_pres_single_ASN1_type,
1692 { "single-ASN1-type", "pres.single_ASN1_type_element",
1693 FT_NONE, BASE_NONE, NULL, 0,
1694 NULL, HFILL }},
1695 { &hf_pres_octet_aligned,
1696 { "octet-aligned", "pres.octet_aligned",
1697 FT_BYTES, BASE_NONE, NULL, 0,
1698 "T_octet_aligned", HFILL }},
1699 { &hf_pres_arbitrary,
1700 { "arbitrary", "pres.arbitrary",
1701 FT_BYTES, BASE_NONE, NULL, 0,
1702 "BIT_STRING", HFILL }},
1703 { &hf_pres_Presentation_requirements_context_management,
1704 { "context-management", "pres.Presentation.requirements.context.management",
1705 FT_BOOLEAN, 8, NULL, 0x80,
1706 NULL, HFILL }},
1707 { &hf_pres_Presentation_requirements_restoration,
1708 { "restoration", "pres.Presentation.requirements.restoration",
1709 FT_BOOLEAN, 8, NULL, 0x40,
1710 NULL, HFILL }},
1711 { &hf_pres_Protocol_options_nominated_context,
1712 { "nominated-context", "pres.Protocol.options.nominated.context",
1713 FT_BOOLEAN, 8, NULL, 0x80,
1714 NULL, HFILL }},
1715 { &hf_pres_Protocol_options_short_encoding,
1716 { "short-encoding", "pres.Protocol.options.short.encoding",
1717 FT_BOOLEAN, 8, NULL, 0x40,
1718 NULL, HFILL }},
1719 { &hf_pres_Protocol_options_packed_encoding_rules,
1720 { "packed-encoding-rules", "pres.Protocol.options.packed.encoding.rules",
1721 FT_BOOLEAN, 8, NULL, 0x20,
1722 NULL, HFILL }},
1723 { &hf_pres_Protocol_version_version_1,
1724 { "version-1", "pres.Protocol.version.version.1",
1725 FT_BOOLEAN, 8, NULL, 0x80,
1726 NULL, HFILL }},
1727 { &hf_pres_User_session_requirements_half_duplex,
1728 { "half-duplex", "pres.User.session.requirements.half.duplex",
1729 FT_BOOLEAN, 8, NULL, 0x80,
1730 NULL, HFILL }},
1731 { &hf_pres_User_session_requirements_duplex,
1732 { "duplex", "pres.User.session.requirements.duplex",
1733 FT_BOOLEAN, 8, NULL, 0x40,
1734 NULL, HFILL }},
1735 { &hf_pres_User_session_requirements_expedited_data,
1736 { "expedited-data", "pres.User.session.requirements.expedited.data",
1737 FT_BOOLEAN, 8, NULL, 0x20,
1738 NULL, HFILL }},
1739 { &hf_pres_User_session_requirements_minor_synchronize,
1740 { "minor-synchronize", "pres.User.session.requirements.minor.synchronize",
1741 FT_BOOLEAN, 8, NULL, 0x10,
1742 NULL, HFILL }},
1743 { &hf_pres_User_session_requirements_major_synchronize,
1744 { "major-synchronize", "pres.User.session.requirements.major.synchronize",
1745 FT_BOOLEAN, 8, NULL, 0x08,
1746 NULL, HFILL }},
1747 { &hf_pres_User_session_requirements_resynchronize,
1748 { "resynchronize", "pres.User.session.requirements.resynchronize",
1749 FT_BOOLEAN, 8, NULL, 0x04,
1750 NULL, HFILL }},
1751 { &hf_pres_User_session_requirements_activity_management,
1752 { "activity-management", "pres.User.session.requirements.activity.management",
1753 FT_BOOLEAN, 8, NULL, 0x02,
1754 NULL, HFILL }},
1755 { &hf_pres_User_session_requirements_negotiated_release,
1756 { "negotiated-release", "pres.User.session.requirements.negotiated.release",
1757 FT_BOOLEAN, 8, NULL, 0x01,
1758 NULL, HFILL }},
1759 { &hf_pres_User_session_requirements_capability_data,
1760 { "capability-data", "pres.User.session.requirements.capability.data",
1761 FT_BOOLEAN, 8, NULL, 0x80,
1762 NULL, HFILL }},
1763 { &hf_pres_User_session_requirements_exceptions,
1764 { "exceptions", "pres.User.session.requirements.exceptions",
1765 FT_BOOLEAN, 8, NULL, 0x40,
1766 NULL, HFILL }},
1767 { &hf_pres_User_session_requirements_typed_data,
1768 { "typed-data", "pres.User.session.requirements.typed.data",
1769 FT_BOOLEAN, 8, NULL, 0x20,
1770 NULL, HFILL }},
1771 { &hf_pres_User_session_requirements_symmetric_synchronize,
1772 { "symmetric-synchronize", "pres.User.session.requirements.symmetric.synchronize",
1773 FT_BOOLEAN, 8, NULL, 0x10,
1774 NULL, HFILL }},
1775 { &hf_pres_User_session_requirements_data_separation,
1776 { "data-separation", "pres.User.session.requirements.data.separation",
1777 FT_BOOLEAN, 8, NULL, 0x08,
1778 NULL, HFILL }},
1781 /* List of subtrees */
1782 static int *ett[] = {
1783 &ett_pres,
1784 &ett_pres_CP_type,
1785 &ett_pres_T_normal_mode_parameters,
1786 &ett_pres_T_extensions,
1787 &ett_pres_CPA_PPDU,
1788 &ett_pres_T_CPA_PPDU_normal_mode_parameters,
1789 &ett_pres_CPR_PPDU,
1790 &ett_pres_T_CPR_PPDU_normal_mode_parameters,
1791 &ett_pres_Abort_type,
1792 &ett_pres_ARU_PPDU,
1793 &ett_pres_T_ARU_PPDU_normal_mode_parameters,
1794 &ett_pres_ARP_PPDU,
1795 &ett_pres_Typed_data_type,
1796 &ett_pres_AC_PPDU,
1797 &ett_pres_ACA_PPDU,
1798 &ett_pres_RS_PPDU,
1799 &ett_pres_RSA_PPDU,
1800 &ett_pres_Context_list,
1801 &ett_pres_Context_list_item,
1802 &ett_pres_SEQUENCE_OF_Transfer_syntax_name,
1803 &ett_pres_Default_context_name,
1804 &ett_pres_Mode_selector,
1805 &ett_pres_Presentation_context_deletion_list,
1806 &ett_pres_Presentation_context_deletion_result_list,
1807 &ett_pres_Presentation_context_identifier_list,
1808 &ett_pres_Presentation_context_identifier_list_item,
1809 &ett_pres_Presentation_requirements,
1810 &ett_pres_Protocol_options,
1811 &ett_pres_Protocol_version,
1812 &ett_pres_Result_list,
1813 &ett_pres_Result_list_item,
1814 &ett_pres_User_data,
1815 &ett_pres_Fully_encoded_data,
1816 &ett_pres_PDV_list,
1817 &ett_pres_T_presentation_data_values,
1818 &ett_pres_User_session_requirements,
1819 &ett_pres_UD_type,
1822 static ei_register_info ei[] = {
1823 { &ei_pres_dissector_not_available, { "pres.dissector_not_available", PI_UNDECODED, PI_WARN, "Dissector is not available", EXPFILL }},
1824 { &ei_pres_wrong_spdu_type, { "pres.wrong_spdu_type", PI_PROTOCOL, PI_WARN, "Internal error:can't get spdu type from session dissector", EXPFILL }},
1825 { &ei_pres_invalid_offset, { "pres.invalid_offset", PI_MALFORMED, PI_ERROR, "Internal error: PPDU made offset go backwards", EXPFILL }},
1828 static uat_field_t users_flds[] = {
1829 UAT_FLD_DEC(pres_users,ctx_id,"Context Id","Presentation Context Identifier"),
1830 UAT_FLD_CSTRING(pres_users,oid,"Syntax Name OID","Abstract Syntax Name (Object Identifier)"),
1831 UAT_END_FIELDS
1834 uat_t* users_uat = uat_new("PRES Users Context List",
1835 sizeof(pres_user_t),
1836 "pres_context_list",
1837 true,
1838 &pres_users,
1839 &num_pres_users,
1840 UAT_AFFECTS_DISSECTION, /* affects dissection of packets, but not set of named fields */
1841 "ChPresContextList",
1842 pres_copy_cb,
1843 NULL,
1844 pres_free_cb,
1845 NULL,
1846 NULL,
1847 users_flds);
1849 expert_module_t* expert_pres;
1850 module_t *pres_module;
1852 /* Register protocol */
1853 proto_pres = proto_register_protocol(PNAME, PSNAME, PFNAME);
1854 register_dissector("pres", dissect_pres, proto_pres);
1856 /* Register connectionless protocol (just for the description) */
1857 proto_clpres = proto_register_protocol(CLPNAME, CLPSNAME, CLPFNAME);
1859 /* Register fields and subtrees */
1860 proto_register_field_array(proto_pres, hf, array_length(hf));
1861 proto_register_subtree_array(ett, array_length(ett));
1862 expert_pres = expert_register_protocol(proto_pres);
1863 expert_register_field_array(expert_pres, ei, array_length(ei));
1864 pres_ctx_oid_table = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), pres_ctx_oid_hash, pres_ctx_oid_equal);
1866 pres_module = prefs_register_protocol(proto_pres, NULL);
1868 prefs_register_uat_preference(pres_module, "users_table", "Users Context List",
1869 "A table that enumerates user protocols to be used against"
1870 " specific presentation context identifiers",
1871 users_uat);
1875 /*--- proto_reg_handoff_pres ---------------------------------------*/
1876 void proto_reg_handoff_pres(void) {
1878 /* register_ber_oid_dissector("0.4.0.0.1.1.1.1", dissect_pres, proto_pres,
1879 "itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) abstractSyntax(1) pres(1) version1(1)"); */