b89a12b8b6fcda4b31cccf58c4a1e448598cbc08
[metze/wireshark/wip.git] / epan / dissectors / packet-atn-ulcs.c
1 /* Do not modify this file. Changes will be overwritten.                      */
2 /* Generated automatically by the ASN.1 to Wireshark dissector compiler       */
3 /* packet-atn-ulcs.c                                                          */
4 /* ../../tools/asn2wrs.py -u -L -p atn-ulcs -c ./atn-ulcs.cnf -s ./packet-atn-ulcs-template -D . -O ../../epan/dissectors atn-ulcs.asn */
5
6 /* Input file: packet-atn-ulcs-template.c */
7
8 #line 1 "../../asn1/atn-ulcs/packet-atn-ulcs-template.c"
9 /* c-basic-offset: 2; tab-width: 2; indent-tabs-mode: t
10  * vi: set shiftwidth=2 tabstop=2 noexpandtab:
11  * :indentSize=2:tabSize=2:noTabs=false:
12  */
13
14 /* packet-atn-ulcs.c
15  * By Mathias Guettler <guettler@web.de>
16  * Copyright 2013
17  *
18  * Routines for ATN upper layer
19  * protocol packet disassembly
20
21  * ATN upper layers are embedded within OSI Layer 4 (COTP).
22  *
23  * ATN upper layers contain:
24  * Session Layer (NUL protocol option)
25  * Presentation Layer (NUL protocol option)
26  * ATN upper Layer/Application (ACSE PDU or PDV-list PDU)
27
28  * ATN applications protocols (i.e. CM or CPDLC) are contained within
29  * ACSE user-information or PDV presentation data.
30
31  * details see:
32  * http://en.wikipedia.org/wiki/CPDLC
33  * http://members.optusnet.com.au/~cjr/introduction.htm
34
35  * standards:
36  * http://legacy.icao.int/anb/panels/acp/repository.cfm
37
38  * note:
39  * We are dealing with ATN/ULCS aka ICAO Doc 9705 Ed2 here
40  * (don't think there is an ULCS equivalent for "FANS-1/A ").
41
42  * Wireshark - Network traffic analyzer
43  * By Gerald Combs <gerald@wireshark.org>
44  * Copyright 1998 Gerald Combs
45  *
46  * This program is free software; you can redistribute it and/or
47  * modify it under the terms of the GNU General Public License
48  * as published by the Free Software Foundation; either version 2
49  * of the License, or (at your option) any later version.
50  *
51  * This program is distributed in the hope that it will be useful,
52  * but WITHOUT ANY WARRANTY; without even the implied warranty of
53  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
54  * GNU General Public License for more details.
55  *
56  * You should have received a copy of the GNU General Public License
57  * along with this program; if not, write to the Free Software
58  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
59  */
60
61 /*
62  developper comments:
63 why not using existing ses, pres and acse dissectors ?
64                 ATN upper layers are derived from OSI standards for session,
65                 presentation and application but the encoding differs
66                 (it's PER instead of BER encoding to save bandwith).
67                 Session and presentation use the "null" encoding option,
68                 meaning that they are only present at connection establishment
69                 and ommitted otherwise.
70                 Instead of adapting existing dissectors it seemed simpler and cleaner
71                 to implement everything the new atn-ulcs dissector.
72
73 why using conversations ?
74                 PER encoded user data is ambigous; the same encoding may apply to a CM or
75                 CPDLC PDU. The workaround is to decode on a transport connection basis.
76                 I use my own version of conversations to identify
77                 the transport connection the PDU belongs to for the standard functions
78                 from "conversation.h" didn't work out.
79
80 what is the use of AARQ/AARE data ?
81                 Converstions should be maintained on the COTP layer in a standard way
82                 for there are usually more packets available than in the layers above.
83                 In the worst case my dissector is called from a DT packet which
84                 has destination references but no source reference.
85                 I have to guess the reference used the other way round
86                 (curently I am using ACSE PDU'S used during OSI connection establishment for that).
87                 The idea is that each ACSE AARQ is answered by ACSE AARE and having this sequence
88                 I have all the source/destination references for this transport connection.
89                 I use AARQ/AARE data to store the source/destination reference of AARQ as well
90                 as the optional ae-qualifier which tells me the application and
91                 the dissector I have to use.
92                 This approach donesn't work well when there are interleaving AARQ/AARE sequences for
93                 the same aircraft.
94
95 which ATN standard is supported ?
96                 The dissector has been tested with ICAO doc9705 Edition2 compliant traffic.
97                 No ATN Secutity is supported.
98                 note:
99                 The ATN upper layers are derived from OSI standards (ICAO DOC 9705)
100                 while ATN/IPS (ICAO DOC 9896) which is entirely based on IPV6.
101
102 */
103
104 /*
105  known defects/deficiencies:
106
107 -       user-information within AARE is sometines not decoded due to an unset flag
108                 (the field is optional). As far as I can tell asn2wrs is right here,
109                 but on the other hand I know that in all of this cases user-information
110                 is present and is processed by the ATN end system.
111                 Maybe a true ATN expert may help me out here.
112
113         - The conversation handling is based on src/dst addresses as well as
114                 source or destination references depending on the TP4 packet type.
115                 This means that after some time these references get reused for
116                 new conversations. This almost certain happens for traces longer
117                 than one day rendering this dissector unsuitable for captures exceeding
118                 this one day.
119
120 */
121
122 #include "config.h"
123
124 #include <glib.h>
125 #include <epan/packet.h>
126 #include <epan/dissectors/packet-ber.h>
127 #include <epan/dissectors/packet-per.h>
128 #include <epan/wmem/wmem.h>
129 #include <epan/address.h>
130 #include <epan/conversation.h>
131
132 #include <stdio.h>
133 #include <string.h>
134
135 #include "packet-atn-ulcs.h"
136
137 #define ATN_ACSE_PROTO "ICAO Doc9705 ULCS ACSE (ISO 8649/8650-1:1996)"
138 #define ATN_ULCS_PROTO "ICAO Doc9705 ULCS"
139
140 void proto_register_atn_ulcs(void);
141 void proto_reg_handoff_atn_ulcs(void);
142
143 static heur_dissector_list_t atn_ulcs_heur_subdissector_list;
144
145 /* presentation subdissectors i.e. CM, CPDLC */
146 static dissector_handle_t atn_cm_handle = NULL;
147 static dissector_handle_t atn_cpdlc_handle = NULL;
148
149 static int proto_atn_ulcs          = -1;
150 static guint32 ulcs_context_value = 0;
151 static const char *object_identifier_id;
152
153 static wmem_tree_t *aarq_data_tree = NULL;
154 static wmem_tree_t *atn_conversation_tree = NULL;
155
156
157 static proto_tree *root_tree = NULL;
158
159 /* forward declarations for functions generated from asn1 */
160 static int dissect_atn_ulcs_T_externalt_encoding_single_asn1_type(
161                 tvbuff_t *tvb _U_,
162                 int offset _U_,
163                 asn1_ctx_t *actx _U_,
164                 proto_tree *tree _U_,
165                 int hf_index
166                 _U_);
167
168 static int dissect_atn_ulcs_T_externalt_encoding_octet_aligned(
169                 tvbuff_t *tvb _U_,
170                 int offset _U_,
171                 asn1_ctx_t *actx _U_,
172                 proto_tree *tree _U_,
173                 int hf_index _U_);
174
175 static int dissect_atn_ulcs_T_externalt_encoding_arbitrary(
176                 tvbuff_t *tvb _U_,
177                 int offset _U_,
178                 asn1_ctx_t *actx _U_,
179                 proto_tree *tree _U_,
180                 int hf_index _U_);
181
182 static void dissect_ACSE_apdu_PDU(
183                 tvbuff_t *tvb _U_,
184                 packet_info *pinfo _U_,
185                 proto_tree *tree _U_);
186
187 guint32 dissect_per_object_descriptor_t(
188                 tvbuff_t *tvb,
189                 guint32 offset,
190                 asn1_ctx_t *actx,
191                 proto_tree *tree,
192                 int hf_index,
193                 tvbuff_t **value_tvb);
194
195 static gint     dissect_atn_ulcs(
196                 tvbuff_t *tvb,
197                 packet_info *pinfo,
198                 proto_tree      *tree,
199                 void *data _U_);
200
201
202 /*--- Included file: packet-atn-ulcs-hf.c ---*/
203 #line 1 "../../asn1/atn-ulcs/packet-atn-ulcs-hf.c"
204 static int hf_atn_ulcs_Fully_encoded_data_PDU = -1;  /* Fully_encoded_data */
205 static int hf_atn_ulcs_ACSE_apdu_PDU = -1;        /* ACSE_apdu */
206 static int hf_atn_ulcs_Fully_encoded_data_item = -1;  /* PDV_list */
207 static int hf_atn_ulcs_transfer_syntax_name = -1;  /* Transfer_syntax_name */
208 static int hf_atn_ulcs_presentation_context_identifier = -1;  /* Presentation_context_identifier */
209 static int hf_atn_ulcs_presentation_data_values = -1;  /* T_presentation_data_values */
210 static int hf_atn_ulcs_pdv_list_presentation_data_values_single_asn1_type = -1;  /* T_pdv_list_presentation_data_values_single_asn1_type */
211 static int hf_atn_ulcs_octet_aligned = -1;        /* OCTET_STRING */
212 static int hf_atn_ulcs_pdv_list_presentation_data_values_arbitrary = -1;  /* T_pdv_list_presentation_data_values_arbitrary */
213 static int hf_atn_ulcs_direct_reference = -1;     /* OBJECT_IDENTIFIER */
214 static int hf_atn_ulcs_indirect_reference = -1;   /* INTEGER */
215 static int hf_atn_ulcs_data_value_descriptor = -1;  /* T_data_value_descriptor */
216 static int hf_atn_ulcs_encoding = -1;             /* T_encoding */
217 static int hf_atn_ulcs_externalt_encoding_single_asn1_type = -1;  /* T_externalt_encoding_single_asn1_type */
218 static int hf_atn_ulcs_externalt_encoding_octet_aligned = -1;  /* T_externalt_encoding_octet_aligned */
219 static int hf_atn_ulcs_externalt_encoding_arbitrary = -1;  /* T_externalt_encoding_arbitrary */
220 static int hf_atn_ulcs_aarq = -1;                 /* AARQ_apdu */
221 static int hf_atn_ulcs_aare = -1;                 /* AARE_apdu */
222 static int hf_atn_ulcs_rlrq = -1;                 /* RLRQ_apdu */
223 static int hf_atn_ulcs_rlre = -1;                 /* RLRE_apdu */
224 static int hf_atn_ulcs_abrt = -1;                 /* ABRT_apdu */
225 static int hf_atn_ulcs_aarq_apdu_protocol_version = -1;  /* T_aarq_apdu_protocol_version */
226 static int hf_atn_ulcs_application_context_name = -1;  /* Application_context_name */
227 static int hf_atn_ulcs_called_AP_title = -1;      /* AP_title */
228 static int hf_atn_ulcs_called_AE_qualifier = -1;  /* AE_qualifier */
229 static int hf_atn_ulcs_called_AP_invocation_identifier = -1;  /* AP_invocation_identifier */
230 static int hf_atn_ulcs_called_AE_invocation_identifier = -1;  /* AE_invocation_identifier */
231 static int hf_atn_ulcs_calling_AP_title = -1;     /* AP_title */
232 static int hf_atn_ulcs_calling_AE_qualifier = -1;  /* AE_qualifier */
233 static int hf_atn_ulcs_calling_AP_invocation_identifier = -1;  /* AP_invocation_identifier */
234 static int hf_atn_ulcs_calling_AE_invocation_identifier = -1;  /* AE_invocation_identifier */
235 static int hf_atn_ulcs_sender_acse_requirements = -1;  /* ACSE_requirements */
236 static int hf_atn_ulcs_mechanism_name = -1;       /* Mechanism_name */
237 static int hf_atn_ulcs_calling_authentication_value = -1;  /* Authentication_value */
238 static int hf_atn_ulcs_application_context_name_list = -1;  /* Application_context_name_list */
239 static int hf_atn_ulcs_implementation_information = -1;  /* Implementation_data */
240 static int hf_atn_ulcs_user_information = -1;     /* Association_information */
241 static int hf_atn_ulcs_aare_apdu_protocol_version = -1;  /* T_aare_apdu_protocol_version */
242 static int hf_atn_ulcs_result = -1;               /* Associate_result */
243 static int hf_atn_ulcs_result_source_diagnostic = -1;  /* Associate_source_diagnostic */
244 static int hf_atn_ulcs_responding_AP_title = -1;  /* AP_title */
245 static int hf_atn_ulcs_responding_AE_qualifier = -1;  /* AE_qualifier */
246 static int hf_atn_ulcs_responding_AP_invocation_identifier = -1;  /* AP_invocation_identifier */
247 static int hf_atn_ulcs_responding_AE_invocation_identifier = -1;  /* AE_invocation_identifier */
248 static int hf_atn_ulcs_responder_acse_requirements = -1;  /* ACSE_requirements */
249 static int hf_atn_ulcs_responding_authentication_value = -1;  /* Authentication_value */
250 static int hf_atn_ulcs_rlrq_apdu_request_reason = -1;  /* Release_request_reason */
251 static int hf_atn_ulcs_rlre_apdu_response_reason = -1;  /* Release_response_reason */
252 static int hf_atn_ulcs_abort_source = -1;         /* ABRT_source */
253 static int hf_atn_ulcs_abort_diagnostic = -1;     /* ABRT_diagnostic */
254 static int hf_atn_ulcs_Application_context_name_list_item = -1;  /* Application_context_name */
255 static int hf_atn_ulcs_ap_title_form2 = -1;       /* AP_title_form2 */
256 static int hf_atn_ulcs_ap_title_form1 = -1;       /* AP_title_form1 */
257 static int hf_atn_ulcs_ae_qualifier_form2 = -1;   /* AE_qualifier_form2 */
258 static int hf_atn_ulcs_ae_qualifier_form1 = -1;   /* AE_qualifier_form1 */
259 static int hf_atn_ulcs_acse_service_user = -1;    /* T_acse_service_user */
260 static int hf_atn_ulcs_acse_service_provider = -1;  /* T_acse_service_provider */
261 static int hf_atn_ulcs_Association_information_item = -1;  /* EXTERNALt */
262 static int hf_atn_ulcs_charstring = -1;           /* OCTET_STRING */
263 static int hf_atn_ulcs_bitstring = -1;            /* BIT_STRING */
264 static int hf_atn_ulcs_external = -1;             /* EXTERNAL */
265 static int hf_atn_ulcs_other = -1;                /* T_other */
266 static int hf_atn_ulcs_other_mechanism_name = -1;  /* OBJECT_IDENTIFIER */
267 static int hf_atn_ulcs_other_mechanism_value = -1;  /* T_other_mechanism_value */
268 static int hf_atn_ulcs_rdnSequence = -1;          /* RDNSequence */
269 static int hf_atn_ulcs_RDNSequence_item = -1;     /* RelativeDistinguishedName */
270 static int hf_atn_ulcs_RelativeDistinguishedName_item = -1;  /* AttributeTypeAndValue */
271 static int hf_atn_ulcs_null = -1;                 /* NULL */
272 /* named bits */
273 static int hf_atn_ulcs_T_aarq_apdu_protocol_version_version1 = -1;
274 static int hf_atn_ulcs_T_aare_apdu_protocol_version_version1 = -1;
275 static int hf_atn_ulcs_ACSE_requirements_authentication = -1;
276 static int hf_atn_ulcs_ACSE_requirements_application_context_negotiation = -1;
277
278 /*--- End of included file: packet-atn-ulcs-hf.c ---*/
279 #line 194 "../../asn1/atn-ulcs/packet-atn-ulcs-template.c"
280
281
282 /*--- Included file: packet-atn-ulcs-ett.c ---*/
283 #line 1 "../../asn1/atn-ulcs/packet-atn-ulcs-ett.c"
284 static gint ett_atn_ulcs_Fully_encoded_data = -1;
285 static gint ett_atn_ulcs_PDV_list = -1;
286 static gint ett_atn_ulcs_T_presentation_data_values = -1;
287 static gint ett_atn_ulcs_EXTERNALt = -1;
288 static gint ett_atn_ulcs_T_encoding = -1;
289 static gint ett_atn_ulcs_ACSE_apdu = -1;
290 static gint ett_atn_ulcs_AARQ_apdu = -1;
291 static gint ett_atn_ulcs_T_aarq_apdu_protocol_version = -1;
292 static gint ett_atn_ulcs_AARE_apdu = -1;
293 static gint ett_atn_ulcs_T_aare_apdu_protocol_version = -1;
294 static gint ett_atn_ulcs_RLRQ_apdu = -1;
295 static gint ett_atn_ulcs_RLRE_apdu = -1;
296 static gint ett_atn_ulcs_ABRT_apdu = -1;
297 static gint ett_atn_ulcs_ACSE_requirements = -1;
298 static gint ett_atn_ulcs_Application_context_name_list = -1;
299 static gint ett_atn_ulcs_AP_title = -1;
300 static gint ett_atn_ulcs_AE_qualifier = -1;
301 static gint ett_atn_ulcs_Associate_source_diagnostic = -1;
302 static gint ett_atn_ulcs_Association_information = -1;
303 static gint ett_atn_ulcs_Authentication_value = -1;
304 static gint ett_atn_ulcs_T_other = -1;
305 static gint ett_atn_ulcs_Name = -1;
306 static gint ett_atn_ulcs_RDNSequence = -1;
307 static gint ett_atn_ulcs_RelativeDistinguishedName = -1;
308 static gint ett_atn_ulcs_AttributeTypeAndValue = -1;
309
310 /*--- End of included file: packet-atn-ulcs-ett.c ---*/
311 #line 196 "../../asn1/atn-ulcs/packet-atn-ulcs-template.c"
312 static gint ett_atn_ulcs = -1;
313 static gint ett_atn_acse = -1;
314
315
316 /*--- Included file: packet-atn-ulcs-fn.c ---*/
317 #line 1 "../../asn1/atn-ulcs/packet-atn-ulcs-fn.c"
318
319
320 static int
321 dissect_atn_ulcs_Transfer_syntax_name(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
322   offset = dissect_per_object_identifier(tvb, offset, actx, tree, hf_index, NULL);
323
324   return offset;
325 }
326
327
328 static const value_string atn_ulcs_Presentation_context_identifier_vals[] = {
329   {   1, "acse-apdu" },
330   {   2, "reserved" },
331   {   3, "user-ase-apdu" },
332   { 0, NULL }
333 };
334
335
336 static int
337 dissect_atn_ulcs_Presentation_context_identifier(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
338
339                 offset = dissect_per_constrained_integer(
340                                 tvb,
341                                 offset,
342                                 actx,
343                                 tree,
344                                 hf_index,
345                                 1U,
346                                 127U,
347                                 &ulcs_context_value,
348                                 TRUE);
349
350
351   return offset;
352 }
353
354
355
356 static int
357 dissect_atn_ulcs_T_pdv_list_presentation_data_values_single_asn1_type(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
358   offset = dissect_per_open_type(tvb, offset, actx, tree, hf_index, NULL);
359
360   return offset;
361 }
362
363
364
365 static int
366 dissect_atn_ulcs_OCTET_STRING(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
367   offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
368                                        NO_BOUND, NO_BOUND, FALSE, NULL);
369
370   return offset;
371 }
372
373
374
375 static int
376 dissect_atn_ulcs_T_pdv_list_presentation_data_values_arbitrary(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
377
378                 packet_info * pinfo = actx->pinfo;
379                 tvbuff_t *tvb_usr = NULL;
380                 proto_item *ti = NULL;
381                 proto_tree *atn_ulcs_tree = NULL;
382                 atn_conversation_t *atn_cv = NULL;
383
384                 /* extract bitstring into new tvb buffer */
385                 offset = dissect_per_bit_string(
386                                 tvb,
387                                 offset,
388                                 actx,
389                                 tree,
390                                 hf_index,
391                                 NO_BOUND,
392                                 NO_BOUND,
393                                 FALSE,
394                                 &tvb_usr,
395                                 NULL);
396
397                 if (tvb_usr) {
398                         /* call appropiate dissector for bitstring data */
399                         switch(ulcs_context_value){
400                                         case  1: /* ACSE PDU*/
401                                                         ti = proto_tree_add_text(
402                                                                         root_tree,
403                                                                         tvb,
404                                                                         offset,
405                                                                         0,
406                                                                         ATN_ACSE_PROTO );
407                                                         atn_ulcs_tree = proto_item_add_subtree(ti, ett_atn_acse);
408
409                                                         dissect_ACSE_apdu_PDU(
410                                                                         tvb_new_subset_remaining(tvb_usr, 0),
411                                                                         pinfo,
412                                                                         atn_ulcs_tree);
413                                                         break;
414                                                 case  3: /* USER data; call subdissector for CM, CPDLC ...  */
415
416                                                                 /* using dstref for PDV-list only occurrs in DT */
417                                                                 atn_cv = find_atn_conversation(
418                                                                                 &pinfo->dst,
419                                                                                 pinfo->clnp_dstref,
420                                                                                 &pinfo->src);
421
422                                                                 if(atn_cv) {
423                                                                                 switch(atn_cv->ae_qualifier){
424                                                                                                 case cma: /* contact management */
425                                                                                                                 call_dissector_with_data(
426                                                                                                                                 atn_cm_handle,
427                                                                                                                                 tvb_new_subset_remaining(tvb_usr, 0),
428                                                                                                                                 pinfo,
429                                                                                                                                 root_tree,
430                                                                                                                                 NULL);
431                                                                                                                 break;
432                                                                                                 case cpdlc: /* plain old cpdlc */
433                                                                                                 case pmcpdlc: /* protected mode cpdlc */
434                                                                                                                 call_dissector_with_data(
435                                                                                                                                 atn_cpdlc_handle,
436                                                                                                                                 tvb_new_subset_remaining(tvb_usr, 0),
437                                                                                                                                 pinfo,
438                                                                                                                                 root_tree,
439                                                                                                                                 NULL);
440                                                                                                                 break;
441                                                                                                 default: /* unknown or unhandled datalink application */
442                                                                                                                 dissector_try_heuristic(
443                                                                                                                                 atn_ulcs_heur_subdissector_list,
444                                                                                                                                 tvb_new_subset_remaining(tvb_usr,0),
445                                                                                                                                 actx->pinfo,
446                                                                                                                                 root_tree,
447                                                                                                                                 NULL);
448                                                                                                                 break;
449                                                                                 }
450                                                                 }
451                                                                 else{
452                                                                                 dissector_try_heuristic(
453                                                                                                 atn_ulcs_heur_subdissector_list,
454                                                                                                 tvb_new_subset_remaining(tvb_usr,0),
455                                                                                                 actx->pinfo,
456                                                                                                 root_tree,
457                                                                                                 NULL);
458                                                                 }
459                                                                 break;
460                                                 default:
461                                                                 break;
462                         } /* switch(ulcs_context_value) */
463                 }
464
465
466   return offset;
467 }
468
469
470 static const value_string atn_ulcs_T_presentation_data_values_vals[] = {
471   {   0, "single-ASN1-type" },
472   {   1, "octet-aligned" },
473   {   2, "arbitrary" },
474   { 0, NULL }
475 };
476
477 static const per_choice_t T_presentation_data_values_choice[] = {
478   {   0, &hf_atn_ulcs_pdv_list_presentation_data_values_single_asn1_type, ASN1_NO_EXTENSIONS     , dissect_atn_ulcs_T_pdv_list_presentation_data_values_single_asn1_type },
479   {   1, &hf_atn_ulcs_octet_aligned, ASN1_NO_EXTENSIONS     , dissect_atn_ulcs_OCTET_STRING },
480   {   2, &hf_atn_ulcs_pdv_list_presentation_data_values_arbitrary, ASN1_NO_EXTENSIONS     , dissect_atn_ulcs_T_pdv_list_presentation_data_values_arbitrary },
481   { 0, NULL, 0, NULL }
482 };
483
484 static int
485 dissect_atn_ulcs_T_presentation_data_values(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
486   offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
487                                  ett_atn_ulcs_T_presentation_data_values, T_presentation_data_values_choice,
488                                  NULL);
489
490   return offset;
491 }
492
493
494 static const per_sequence_t PDV_list_sequence[] = {
495   { &hf_atn_ulcs_transfer_syntax_name, ASN1_NO_EXTENSIONS     , ASN1_OPTIONAL    , dissect_atn_ulcs_Transfer_syntax_name },
496   { &hf_atn_ulcs_presentation_context_identifier, ASN1_NO_EXTENSIONS     , ASN1_NOT_OPTIONAL, dissect_atn_ulcs_Presentation_context_identifier },
497   { &hf_atn_ulcs_presentation_data_values, ASN1_NO_EXTENSIONS     , ASN1_NOT_OPTIONAL, dissect_atn_ulcs_T_presentation_data_values },
498   { NULL, 0, 0, NULL }
499 };
500
501 static int
502 dissect_atn_ulcs_PDV_list(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
503   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
504                                    ett_atn_ulcs_PDV_list, PDV_list_sequence);
505
506   return offset;
507 }
508
509
510 static const per_sequence_t Fully_encoded_data_sequence_of[1] = {
511   { &hf_atn_ulcs_Fully_encoded_data_item, ASN1_NO_EXTENSIONS     , ASN1_NOT_OPTIONAL, dissect_atn_ulcs_PDV_list },
512 };
513
514 static int
515 dissect_atn_ulcs_Fully_encoded_data(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
516   offset = dissect_per_constrained_sequence_of(tvb, offset, actx, tree, hf_index,
517                                                   ett_atn_ulcs_Fully_encoded_data, Fully_encoded_data_sequence_of,
518                                                   1, 1, TRUE);
519
520   return offset;
521 }
522
523
524
525 static int
526 dissect_atn_ulcs_OBJECT_IDENTIFIER(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
527   offset = dissect_per_object_identifier(tvb, offset, actx, tree, hf_index, NULL);
528
529   return offset;
530 }
531
532
533
534 static int
535 dissect_atn_ulcs_INTEGER(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
536   offset = dissect_per_integer(tvb, offset, actx, tree, hf_index, NULL);
537
538   return offset;
539 }
540
541
542
543 static int
544 dissect_atn_ulcs_T_data_value_descriptor(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
545
546         offset = dissect_per_octet_string(
547                         tvb,
548                         offset,
549                         actx,
550                         tree,
551                         hf_index,
552                         -1,
553                         -1,
554                         FALSE,
555                         &actx->external.data_value_descriptor);
556   actx->external.data_value_descr_present = TRUE;
557
558
559   return offset;
560 }
561
562
563
564 static int
565 dissect_atn_ulcs_T_externalt_encoding_single_asn1_type(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
566
567           offset = dissect_per_open_type(tvb, offset, actx, tree, hf_index, NULL);
568
569
570
571   return offset;
572 }
573
574
575
576 static int
577 dissect_atn_ulcs_T_externalt_encoding_octet_aligned(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
578
579           offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
580                                        NO_BOUND, NO_BOUND, FALSE, NULL);
581
582
583
584   return offset;
585 }
586
587
588
589 static int
590 dissect_atn_ulcs_T_externalt_encoding_arbitrary(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
591         tvbuff_t *tvb_usr = NULL;
592         packet_info * pinfo = actx->pinfo;
593         atn_conversation_t *atn_cv = NULL;
594
595         /* decode bit-string user data within ACSE  */
596         offset = dissect_per_bit_string(
597                 tvb,
598                 offset,
599                 actx,
600                 tree, hf_index,
601                 NO_BOUND,
602                 NO_BOUND,
603                 FALSE,
604                 &tvb_usr,
605                 NULL);
606
607         if (tvb_usr) {
608                 /* DT: dstref present, srcref is always zero */
609                 if((pinfo->clnp_dstref) && (!pinfo->clnp_srcref)){
610
611                         atn_cv = find_atn_conversation(
612                                         &pinfo->dst,
613                                         pinfo->clnp_dstref,
614                                         &pinfo->src);
615                 }
616                 /* CR: srcref present, dstref always zero */
617                 if((pinfo->clnp_srcref) && (!pinfo->clnp_dstref)){
618
619                         atn_cv = find_atn_conversation(
620                                         &pinfo->src,
621                                         pinfo->clnp_srcref,
622                                         &pinfo->dst);
623                 }
624                 /* CC: srcref and dstref present */
625                 if((pinfo->clnp_srcref) && (pinfo->clnp_dstref)){
626
627                         atn_cv = find_atn_conversation(
628                                         &pinfo->src,
629                                         pinfo->clnp_srcref,
630                                         &pinfo->dst);
631                 }
632
633                 if(atn_cv) {
634                                 switch(atn_cv->ae_qualifier){
635                                         case cma: /* contact management */
636
637                                                         call_dissector_with_data(
638                                                                                 atn_cm_handle,
639                                                                                 tvb_new_subset_remaining(tvb_usr, 0),
640                                                                                 pinfo,
641                                                                                 root_tree,
642                                                                                 NULL);
643                                                         break;
644                                         case cpdlc: /* plain old cpdlc */
645                                         case pmcpdlc: /* protected mode cpdlc */
646
647                                                         call_dissector_with_data(
648                                                                                 atn_cpdlc_handle,
649                                                                                 tvb_new_subset_remaining(tvb_usr, 0),
650                                                                                 pinfo,
651                                                                                 root_tree,
652                                                                                 NULL);
653                                                         break;
654                                         default: /* unknown or unhandled datalink application */
655
656                                                         dissector_try_heuristic(
657                                                                         atn_ulcs_heur_subdissector_list,
658                                                                         tvb_new_subset_remaining(tvb_usr,0),
659                                                                         actx->pinfo,
660                                                                         root_tree,
661                                                                         NULL);
662                                                                 break;
663                                         }
664                 }else {
665
666                         dissector_try_heuristic(
667                                                         atn_ulcs_heur_subdissector_list,
668                                                         tvb_new_subset_remaining(tvb_usr,0),
669                                                         actx->pinfo,
670                                                         root_tree,
671                                                         NULL);
672                 }
673         }
674
675         offset += tvb_length_remaining(tvb, offset);
676
677
678   return offset;
679 }
680
681
682 static const value_string atn_ulcs_T_encoding_vals[] = {
683   {   0, "single-ASN1-type" },
684   {   1, "octet-aligned" },
685   {   2, "arbitrary" },
686   { 0, NULL }
687 };
688
689 static const per_choice_t T_encoding_choice[] = {
690   {   0, &hf_atn_ulcs_externalt_encoding_single_asn1_type, ASN1_NO_EXTENSIONS     , dissect_atn_ulcs_T_externalt_encoding_single_asn1_type },
691   {   1, &hf_atn_ulcs_externalt_encoding_octet_aligned, ASN1_NO_EXTENSIONS     , dissect_atn_ulcs_T_externalt_encoding_octet_aligned },
692   {   2, &hf_atn_ulcs_externalt_encoding_arbitrary, ASN1_NO_EXTENSIONS     , dissect_atn_ulcs_T_externalt_encoding_arbitrary },
693   { 0, NULL, 0, NULL }
694 };
695
696 static int
697 dissect_atn_ulcs_T_encoding(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
698   offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
699                                  ett_atn_ulcs_T_encoding, T_encoding_choice,
700                                  NULL);
701
702   return offset;
703 }
704
705
706 static const per_sequence_t EXTERNALt_sequence[] = {
707   { &hf_atn_ulcs_direct_reference, ASN1_NO_EXTENSIONS     , ASN1_OPTIONAL    , dissect_atn_ulcs_OBJECT_IDENTIFIER },
708   { &hf_atn_ulcs_indirect_reference, ASN1_NO_EXTENSIONS     , ASN1_OPTIONAL    , dissect_atn_ulcs_INTEGER },
709   { &hf_atn_ulcs_data_value_descriptor, ASN1_NO_EXTENSIONS     , ASN1_OPTIONAL    , dissect_atn_ulcs_T_data_value_descriptor },
710   { &hf_atn_ulcs_encoding   , ASN1_NO_EXTENSIONS     , ASN1_NOT_OPTIONAL, dissect_atn_ulcs_T_encoding },
711   { NULL, 0, 0, NULL }
712 };
713
714 static int
715 dissect_atn_ulcs_EXTERNALt(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
716   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
717                                    ett_atn_ulcs_EXTERNALt, EXTERNALt_sequence);
718
719   return offset;
720 }
721
722
723
724 static int
725 dissect_atn_ulcs_T_aarq_apdu_protocol_version(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
726   offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index,
727                                      NO_BOUND, NO_BOUND, FALSE, NULL, NULL);
728
729   return offset;
730 }
731
732
733
734 static int
735 dissect_atn_ulcs_Application_context_name(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
736   offset = dissect_per_object_identifier(tvb, offset, actx, tree, hf_index, NULL);
737
738   return offset;
739 }
740
741
742
743 static int
744 dissect_atn_ulcs_AP_title_form2(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
745   offset = dissect_per_object_identifier(tvb, offset, actx, tree, hf_index, NULL);
746
747   return offset;
748 }
749
750
751
752 static int
753 dissect_atn_ulcs_NULL(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
754   offset = dissect_per_null(tvb, offset, actx, tree, hf_index);
755
756   return offset;
757 }
758
759
760 static const per_sequence_t AttributeTypeAndValue_sequence[] = {
761   { &hf_atn_ulcs_null       , ASN1_NO_EXTENSIONS     , ASN1_NOT_OPTIONAL, dissect_atn_ulcs_NULL },
762   { NULL, 0, 0, NULL }
763 };
764
765 static int
766 dissect_atn_ulcs_AttributeTypeAndValue(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
767   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
768                                    ett_atn_ulcs_AttributeTypeAndValue, AttributeTypeAndValue_sequence);
769
770   return offset;
771 }
772
773
774 static const per_sequence_t RelativeDistinguishedName_set_of[1] = {
775   { &hf_atn_ulcs_RelativeDistinguishedName_item, ASN1_NO_EXTENSIONS     , ASN1_NOT_OPTIONAL, dissect_atn_ulcs_AttributeTypeAndValue },
776 };
777
778 static int
779 dissect_atn_ulcs_RelativeDistinguishedName(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
780   offset = dissect_per_constrained_set_of(tvb, offset, actx, tree, hf_index,
781                                              ett_atn_ulcs_RelativeDistinguishedName, RelativeDistinguishedName_set_of,
782                                              1, NO_BOUND, FALSE);
783
784   return offset;
785 }
786
787
788 static const per_sequence_t RDNSequence_sequence_of[1] = {
789   { &hf_atn_ulcs_RDNSequence_item, ASN1_NO_EXTENSIONS     , ASN1_NOT_OPTIONAL, dissect_atn_ulcs_RelativeDistinguishedName },
790 };
791
792 static int
793 dissect_atn_ulcs_RDNSequence(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
794   offset = dissect_per_sequence_of(tvb, offset, actx, tree, hf_index,
795                                       ett_atn_ulcs_RDNSequence, RDNSequence_sequence_of);
796
797   return offset;
798 }
799
800
801 static const value_string atn_ulcs_Name_vals[] = {
802   {   0, "rdnSequence" },
803   { 0, NULL }
804 };
805
806 static const per_choice_t Name_choice[] = {
807   {   0, &hf_atn_ulcs_rdnSequence, ASN1_NO_EXTENSIONS     , dissect_atn_ulcs_RDNSequence },
808   { 0, NULL, 0, NULL }
809 };
810
811 static int
812 dissect_atn_ulcs_Name(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
813   offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
814                                  ett_atn_ulcs_Name, Name_choice,
815                                  NULL);
816
817   return offset;
818 }
819
820
821
822 static int
823 dissect_atn_ulcs_AP_title_form1(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
824   offset = dissect_atn_ulcs_Name(tvb, offset, actx, tree, hf_index);
825
826   return offset;
827 }
828
829
830 static const value_string atn_ulcs_AP_title_vals[] = {
831   {   0, "ap-title-form2" },
832   {   1, "ap-title-form1" },
833   { 0, NULL }
834 };
835
836 static const per_choice_t AP_title_choice[] = {
837   {   0, &hf_atn_ulcs_ap_title_form2, ASN1_EXTENSION_ROOT    , dissect_atn_ulcs_AP_title_form2 },
838   {   1, &hf_atn_ulcs_ap_title_form1, ASN1_EXTENSION_ROOT    , dissect_atn_ulcs_AP_title_form1 },
839   { 0, NULL, 0, NULL }
840 };
841
842 static int
843 dissect_atn_ulcs_AP_title(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
844   offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
845                                  ett_atn_ulcs_AP_title, AP_title_choice,
846                                  NULL);
847
848   return offset;
849 }
850
851
852
853 static int
854 dissect_atn_ulcs_AE_qualifier_form2(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
855                 packet_info * pinfo = actx->pinfo;
856                 atn_conversation_t *atn_cv = NULL;
857                 guint32 ae_qualifier = 0;
858
859                 /* dissect  ae-qualifier */
860                 offset = dissect_per_integer(
861                                 tvb,
862                                 offset,
863                                 actx,
864                                 tree,
865                                 hf_index,
866                                 &ae_qualifier);
867
868
869                 /*note: */
870                 /* the field "calling-AE-qualifier" is optional, */
871                 /* which means that we can exploit it only if it is present. */
872                 /* We still depend on heuristical decoding of CM, CPDLC PDU's otherwise. */
873
874                 /* AARQ/DT: dstref present, srcref is always zero */
875                 if((pinfo->clnp_dstref) && (!pinfo->clnp_srcref)){
876                                 atn_cv = find_atn_conversation(&pinfo->dst,
877                                                 pinfo->clnp_dstref,
878                                                 &pinfo->src );
879                 }
880
881                 /* AARQ/CR: srcref present, dstref is always zero */
882                 if((!pinfo->clnp_dstref) && (pinfo->clnp_srcref)){
883                                 atn_cv = find_atn_conversation(&pinfo->src,
884                                                 pinfo->clnp_srcref,
885                                                 &pinfo->dst );
886         }
887
888         if(atn_cv){
889                         atn_cv->ae_qualifier = ae_qualifier;
890         }
891
892   return offset;
893 }
894
895
896
897 static int
898 dissect_atn_ulcs_AE_qualifier_form1(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
899   offset = dissect_atn_ulcs_RelativeDistinguishedName(tvb, offset, actx, tree, hf_index);
900
901   return offset;
902 }
903
904
905 static const value_string atn_ulcs_AE_qualifier_vals[] = {
906   {   0, "ae-qualifier-form2" },
907   {   1, "ae-qualifier-form1" },
908   { 0, NULL }
909 };
910
911 static const per_choice_t AE_qualifier_choice[] = {
912   {   0, &hf_atn_ulcs_ae_qualifier_form2, ASN1_EXTENSION_ROOT    , dissect_atn_ulcs_AE_qualifier_form2 },
913   {   1, &hf_atn_ulcs_ae_qualifier_form1, ASN1_EXTENSION_ROOT    , dissect_atn_ulcs_AE_qualifier_form1 },
914   { 0, NULL, 0, NULL }
915 };
916
917 static int
918 dissect_atn_ulcs_AE_qualifier(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
919   offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
920                                  ett_atn_ulcs_AE_qualifier, AE_qualifier_choice,
921                                  NULL);
922
923   return offset;
924 }
925
926
927
928 static int
929 dissect_atn_ulcs_AP_invocation_identifier(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
930   offset = dissect_per_integer(tvb, offset, actx, tree, hf_index, NULL);
931
932   return offset;
933 }
934
935
936
937 static int
938 dissect_atn_ulcs_AE_invocation_identifier(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
939   offset = dissect_per_integer(tvb, offset, actx, tree, hf_index, NULL);
940
941   return offset;
942 }
943
944
945
946 static int
947 dissect_atn_ulcs_ACSE_requirements(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
948   offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index,
949                                      NO_BOUND, NO_BOUND, FALSE, NULL, NULL);
950
951   return offset;
952 }
953
954
955
956 static int
957 dissect_atn_ulcs_Mechanism_name(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
958
959                 offset = dissect_per_object_identifier(
960                                 tvb,
961                                 offset,
962                                 actx,
963                                 tree,
964                                 hf_index,
965                                 NULL);
966
967
968   offset = dissect_per_object_identifier(
969                         tvb,
970                         offset,
971                         actx,
972                         tree,
973                         hf_index,
974                         NULL);
975
976
977   return offset;
978 }
979
980
981
982 static int
983 dissect_atn_ulcs_BIT_STRING(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
984   offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index,
985                                      NO_BOUND, NO_BOUND, FALSE, NULL, NULL);
986
987   return offset;
988 }
989
990
991
992 static int
993 dissect_atn_ulcs_EXTERNAL(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
994   offset = dissect_per_external_type(tvb, offset, actx, tree, hf_index, NULL);
995
996   return offset;
997 }
998
999
1000
1001 static int
1002 dissect_atn_ulcs_T_other_mechanism_value(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1003
1004                 offset=call_ber_oid_callback(
1005                                 object_identifier_id,
1006                                 tvb,
1007                                 offset,
1008                                 actx->pinfo,
1009                                 tree, NULL);
1010
1011
1012                 offset=call_ber_oid_callback(
1013                                 object_identifier_id,
1014                                 tvb,
1015                                 offset,
1016                                 actx->pinfo,
1017                                 tree, NULL);
1018
1019
1020   return offset;
1021 }
1022
1023
1024 static const per_sequence_t T_other_sequence[] = {
1025   { &hf_atn_ulcs_other_mechanism_name, ASN1_NO_EXTENSIONS     , ASN1_NOT_OPTIONAL, dissect_atn_ulcs_OBJECT_IDENTIFIER },
1026   { &hf_atn_ulcs_other_mechanism_value, ASN1_NO_EXTENSIONS     , ASN1_NOT_OPTIONAL, dissect_atn_ulcs_T_other_mechanism_value },
1027   { NULL, 0, 0, NULL }
1028 };
1029
1030 static int
1031 dissect_atn_ulcs_T_other(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1032   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
1033                                    ett_atn_ulcs_T_other, T_other_sequence);
1034
1035   return offset;
1036 }
1037
1038
1039 static const value_string atn_ulcs_Authentication_value_vals[] = {
1040   {   0, "charstring" },
1041   {   1, "bitstring" },
1042   {   2, "external" },
1043   {   3, "other" },
1044   { 0, NULL }
1045 };
1046
1047 static const per_choice_t Authentication_value_choice[] = {
1048   {   0, &hf_atn_ulcs_charstring , ASN1_NO_EXTENSIONS     , dissect_atn_ulcs_OCTET_STRING },
1049   {   1, &hf_atn_ulcs_bitstring  , ASN1_NO_EXTENSIONS     , dissect_atn_ulcs_BIT_STRING },
1050   {   2, &hf_atn_ulcs_external   , ASN1_NO_EXTENSIONS     , dissect_atn_ulcs_EXTERNAL },
1051   {   3, &hf_atn_ulcs_other      , ASN1_NO_EXTENSIONS     , dissect_atn_ulcs_T_other },
1052   { 0, NULL, 0, NULL }
1053 };
1054
1055 static int
1056 dissect_atn_ulcs_Authentication_value(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1057   offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
1058                                  ett_atn_ulcs_Authentication_value, Authentication_value_choice,
1059                                  NULL);
1060
1061   return offset;
1062 }
1063
1064
1065 static const per_sequence_t Application_context_name_list_sequence_of[1] = {
1066   { &hf_atn_ulcs_Application_context_name_list_item, ASN1_NO_EXTENSIONS     , ASN1_NOT_OPTIONAL, dissect_atn_ulcs_Application_context_name },
1067 };
1068
1069 static int
1070 dissect_atn_ulcs_Application_context_name_list(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1071   offset = dissect_per_sequence_of(tvb, offset, actx, tree, hf_index,
1072                                       ett_atn_ulcs_Application_context_name_list, Application_context_name_list_sequence_of);
1073
1074   return offset;
1075 }
1076
1077
1078
1079 static int
1080 dissect_atn_ulcs_Implementation_data(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1081   offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
1082                                        NO_BOUND, NO_BOUND, FALSE, NULL);
1083
1084   return offset;
1085 }
1086
1087
1088 static const per_sequence_t Association_information_sequence_of[1] = {
1089   { &hf_atn_ulcs_Association_information_item, ASN1_NO_EXTENSIONS     , ASN1_NOT_OPTIONAL, dissect_atn_ulcs_EXTERNALt },
1090 };
1091
1092 static int
1093 dissect_atn_ulcs_Association_information(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1094   offset = dissect_per_constrained_sequence_of(tvb, offset, actx, tree, hf_index,
1095                                                   ett_atn_ulcs_Association_information, Association_information_sequence_of,
1096                                                   1, 1, TRUE);
1097
1098   return offset;
1099 }
1100
1101
1102 static const per_sequence_t AARQ_apdu_sequence[] = {
1103   { &hf_atn_ulcs_aarq_apdu_protocol_version, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_T_aarq_apdu_protocol_version },
1104   { &hf_atn_ulcs_application_context_name, ASN1_EXTENSION_ROOT    , ASN1_NOT_OPTIONAL, dissect_atn_ulcs_Application_context_name },
1105   { &hf_atn_ulcs_called_AP_title, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_AP_title },
1106   { &hf_atn_ulcs_called_AE_qualifier, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_AE_qualifier },
1107   { &hf_atn_ulcs_called_AP_invocation_identifier, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_AP_invocation_identifier },
1108   { &hf_atn_ulcs_called_AE_invocation_identifier, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_AE_invocation_identifier },
1109   { &hf_atn_ulcs_calling_AP_title, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_AP_title },
1110   { &hf_atn_ulcs_calling_AE_qualifier, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_AE_qualifier },
1111   { &hf_atn_ulcs_calling_AP_invocation_identifier, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_AP_invocation_identifier },
1112   { &hf_atn_ulcs_calling_AE_invocation_identifier, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_AE_invocation_identifier },
1113   { &hf_atn_ulcs_sender_acse_requirements, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_ACSE_requirements },
1114   { &hf_atn_ulcs_mechanism_name, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_Mechanism_name },
1115   { &hf_atn_ulcs_calling_authentication_value, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_Authentication_value },
1116   { &hf_atn_ulcs_application_context_name_list, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_Application_context_name_list },
1117   { &hf_atn_ulcs_implementation_information, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_Implementation_data },
1118   { &hf_atn_ulcs_user_information, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_Association_information },
1119   { NULL, 0, 0, NULL }
1120 };
1121
1122 static int
1123 dissect_atn_ulcs_AARQ_apdu(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1124                 packet_info * pinfo = actx->pinfo;
1125                 aarq_data_t *aarq_data = NULL;
1126                 atn_conversation_t *atn_cv = NULL;
1127                 guint32 aircraft_24_bit_address = 0;
1128
1129                 /* AARQ/DT: dstref present, srcref is always zero */
1130                 if((pinfo->clnp_dstref) && (!pinfo->clnp_srcref)){
1131
1132                                 atn_cv = find_atn_conversation(
1133                                                 &pinfo->dst,
1134                                                 pinfo->clnp_dstref,
1135                                                 &pinfo->src );
1136                                 if(!atn_cv){
1137                                                 atn_cv = wmem_new(wmem_file_scope(), atn_conversation_t);
1138                                                 atn_cv->ae_qualifier = unknown;
1139                                                 create_atn_conversation(&pinfo->dst,
1140                                                                 pinfo->clnp_dstref,
1141                                                                 &pinfo->src ,
1142                                                                 atn_cv);
1143                                 }
1144                 }
1145
1146         /* AARQ/CR: srcref present, dstref is always zero */
1147                 if((!pinfo->clnp_dstref) && (pinfo->clnp_srcref)){
1148                                 atn_cv = find_atn_conversation(&pinfo->src,
1149                                                 pinfo->clnp_srcref,
1150                                                 &pinfo->dst );
1151                                 if(!atn_cv){
1152                                                 atn_cv = wmem_new(wmem_file_scope(), atn_conversation_t);
1153                                                 atn_cv->ae_qualifier = unknown;
1154                                                 create_atn_conversation(&pinfo->src,
1155                                                                 pinfo->clnp_srcref,
1156                                                                 &pinfo->dst ,
1157                                                                 atn_cv);
1158                                 }
1159                 }
1160
1161                 /* conversation is to be created prior to decoding */
1162                 /* of "AE-qualifier-form2" which takes place here: */
1163                   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
1164                                    ett_atn_ulcs_AARQ_apdu, AARQ_apdu_sequence);
1165
1166
1167
1168                 /* save AARQ packet data to create a conversation  */
1169                 /* when decoding the following AARE PDU */
1170                 /* ATN applications CM and CPDLC are air/ground applications */
1171                 /* so there is always an aircraft (with its 24-bit address) */
1172                 /* and a ground facility. */
1173                 /* the assumption is that there is only one open AARQ/AARE */
1174                 /* dialog per aircraft at a time. */
1175                 /* the aircraft's 24-bit address is used as a key to each AARQ */
1176                 /* data. AARQ data is used to create a conversation with */
1177                 /* air and ground endpoints (based on NSAP's and transport references) */
1178                 /* when decoding AARE.*/
1179                 /* note: */
1180                 /* it may be more robust to create the conversation */
1181                 /* in the "ositp" dissector an to merely use the conversation here */
1182                 aircraft_24_bit_address =
1183                                 get_aircraft_24_bit_address_from_nsap(pinfo);
1184
1185                 /* search for aarq entry */
1186                 aarq_data = (aarq_data_t *) wmem_tree_lookup32(
1187                                 aarq_data_tree,
1188                                 aircraft_24_bit_address);
1189
1190                 if(!aarq_data){  /* aarq data not found, create new record */
1191
1192                                 /* alloc aarq data */
1193                                 aarq_data = wmem_new(wmem_file_scope(), aarq_data_t);
1194                                 aarq_data-> aarq_pending = FALSE;
1195
1196                                 /* insert aarq data */
1197                                 wmem_tree_insert32(aarq_data_tree ,aircraft_24_bit_address,(void*)aarq_data);
1198                 }
1199
1200                 /* check for pending AARQ/AARE sequences */
1201                 /* if "aarq_data-> aarq_pending" is set this means that there is already one  */
1202                 /* AARQ/AARE sequence pending (is unwise to overwrite AARE/AARQ) */
1203                 if (aarq_data-> aarq_pending == FALSE ) {
1204
1205                         /* init aarq data */
1206                         memset(aarq_data,0,sizeof(aarq_data_t));
1207
1208                         aarq_data->cv = atn_cv;
1209                         aarq_data-> aarq_pending = TRUE;
1210                 }
1211
1212
1213   return offset;
1214 }
1215
1216
1217
1218 static int
1219 dissect_atn_ulcs_T_aare_apdu_protocol_version(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1220   offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index,
1221                                      NO_BOUND, NO_BOUND, FALSE, NULL, NULL);
1222
1223   return offset;
1224 }
1225
1226
1227 static const value_string atn_ulcs_Associate_result_vals[] = {
1228   {   0, "accepted" },
1229   {   1, "rejected-permanent" },
1230   {   2, "rejected-transient" },
1231   { 0, NULL }
1232 };
1233
1234
1235 static int
1236 dissect_atn_ulcs_Associate_result(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1237  /* extension present: last param set to true. asn2wrs didn't take notice of that */
1238  offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
1239                                                             0U, 2U, NULL, TRUE);
1240
1241   return offset;
1242 }
1243
1244
1245 static const value_string atn_ulcs_T_acse_service_user_vals[] = {
1246   {   0, "null" },
1247   {   1, "no-reason-given" },
1248   {   2, "application-context-name-not-supported" },
1249   {   3, "calling-AP-title-not-recognized" },
1250   {   4, "calling-AP-invocation-identifier-not-recognized" },
1251   {   5, "calling-AE-qualifier-not-recognized" },
1252   {   6, "calling-AE-invocation-identifier-not-recognized" },
1253   {   7, "called-AP-title-not-recognized" },
1254   {   8, "called-AP-invocation-identifier-not-recognized" },
1255   {   9, "called-AE-qualifier-not-recognized" },
1256   {  10, "called-AE-invocation-identifier-not-recognized" },
1257   {  11, "authentication-mechanism-name-not-recognized" },
1258   {  12, "authentication-mechanism-name-required" },
1259   {  13, "authentication-failure" },
1260   {  14, "authentication-required" },
1261   { 0, NULL }
1262 };
1263
1264
1265 static int
1266 dissect_atn_ulcs_T_acse_service_user(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1267   offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
1268                                                             0U, 14U, NULL, TRUE);
1269
1270   return offset;
1271 }
1272
1273
1274 static const value_string atn_ulcs_T_acse_service_provider_vals[] = {
1275   {   0, "null" },
1276   {   1, "no-reason-given" },
1277   {   2, "no-common-acse-version" },
1278   { 0, NULL }
1279 };
1280
1281
1282 static int
1283 dissect_atn_ulcs_T_acse_service_provider(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1284   offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
1285                                                             0U, 2U, NULL, TRUE);
1286
1287   return offset;
1288 }
1289
1290
1291 static const value_string atn_ulcs_Associate_source_diagnostic_vals[] = {
1292   {   1, "acse-service-user" },
1293   {   2, "acse-service-provider" },
1294   { 0, NULL }
1295 };
1296
1297 static const per_choice_t Associate_source_diagnostic_choice[] = {
1298   {   1, &hf_atn_ulcs_acse_service_user, ASN1_NO_EXTENSIONS     , dissect_atn_ulcs_T_acse_service_user },
1299   {   2, &hf_atn_ulcs_acse_service_provider, ASN1_NO_EXTENSIONS     , dissect_atn_ulcs_T_acse_service_provider },
1300   { 0, NULL, 0, NULL }
1301 };
1302
1303 static int
1304 dissect_atn_ulcs_Associate_source_diagnostic(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1305   offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
1306                                  ett_atn_ulcs_Associate_source_diagnostic, Associate_source_diagnostic_choice,
1307                                  NULL);
1308
1309   return offset;
1310 }
1311
1312
1313 static const per_sequence_t AARE_apdu_sequence[] = {
1314   { &hf_atn_ulcs_aare_apdu_protocol_version, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_T_aare_apdu_protocol_version },
1315   { &hf_atn_ulcs_application_context_name, ASN1_EXTENSION_ROOT    , ASN1_NOT_OPTIONAL, dissect_atn_ulcs_Application_context_name },
1316   { &hf_atn_ulcs_result     , ASN1_EXTENSION_ROOT    , ASN1_NOT_OPTIONAL, dissect_atn_ulcs_Associate_result },
1317   { &hf_atn_ulcs_result_source_diagnostic, ASN1_EXTENSION_ROOT    , ASN1_NOT_OPTIONAL, dissect_atn_ulcs_Associate_source_diagnostic },
1318   { &hf_atn_ulcs_responding_AP_title, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_AP_title },
1319   { &hf_atn_ulcs_responding_AE_qualifier, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_AE_qualifier },
1320   { &hf_atn_ulcs_responding_AP_invocation_identifier, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_AP_invocation_identifier },
1321   { &hf_atn_ulcs_responding_AE_invocation_identifier, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_AE_invocation_identifier },
1322   { &hf_atn_ulcs_responder_acse_requirements, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_ACSE_requirements },
1323   { &hf_atn_ulcs_mechanism_name, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_Mechanism_name },
1324   { &hf_atn_ulcs_responding_authentication_value, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_Authentication_value },
1325   { &hf_atn_ulcs_application_context_name_list, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_Application_context_name_list },
1326   { &hf_atn_ulcs_implementation_information, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_Implementation_data },
1327   { &hf_atn_ulcs_user_information, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_Association_information },
1328   { NULL, 0, 0, NULL }
1329 };
1330
1331 static int
1332 dissect_atn_ulcs_AARE_apdu(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1333         packet_info * pinfo = actx->pinfo;
1334         guint32 aircraft_24_bit_address = 0 ;
1335         atn_conversation_t *atn_cv = NULL;
1336         aarq_data_t *aarq_data = NULL;
1337
1338         /* get AARQ data and use it to create a new conversation, */
1339         /* the conversation is used along with  */
1340         /* AARQ's "calling ae qualifier" to determine the */
1341         /* type of air/ground application of each subsequent frame.*/
1342         /* we use this information to invoke the correct application dissector. */
1343         /* note: */
1344         /* heuristical decoding of ASN1 will not work for all cases, */
1345         /* for there may be CM PDU's which will exactly look like CPDLC PDU'S */
1346
1347         /* get 24-bit icao address */
1348         aircraft_24_bit_address = get_aircraft_24_bit_address_from_nsap(pinfo);
1349
1350         /* search for aarq entry */
1351         aarq_data = (aarq_data_t *) wmem_tree_lookup32(
1352                         aarq_data_tree,
1353                         aircraft_24_bit_address);
1354
1355         /* no aarq data present, do nothing  */
1356         /* without both ends of the conversation and without */
1357         /* the "calling ae-qualifier there is no point in setting up "*/
1358         /* a conversation */
1359         if(!aarq_data) {
1360
1361                 return offset;
1362         }
1363
1364         /* AARE/DT: dstref present, srcref is always zero */
1365         if((pinfo->clnp_dstref) && (!pinfo->clnp_srcref)){
1366
1367                 atn_cv = find_atn_conversation(&pinfo->dst,
1368                                                                                                         pinfo->clnp_dstref,
1369                                                                                                         &pinfo->src );
1370
1371                 if(!atn_cv){ /* conversation not fond */
1372
1373                         /* DT has only dstref - create new conversation */
1374                         create_atn_conversation(&pinfo->dst,
1375                                                                                                                         pinfo->clnp_dstref,
1376                                                                                                                         &pinfo->src ,
1377                                                                                                                         aarq_data->cv);
1378                 }
1379         }
1380
1381         /* AARE/CC: srcref and dstref present  */
1382         if((pinfo->clnp_dstref) && (pinfo->clnp_srcref)){
1383
1384                 atn_cv = find_atn_conversation(
1385                                 &pinfo->src,
1386                                 pinfo->clnp_srcref,
1387         &pinfo->dst);
1388
1389                 if(atn_cv){ /* conversation found. */
1390
1391                         /* create new conversation for dstref */
1392                         create_atn_conversation(&pinfo->dst,
1393                                                                                                                         pinfo->clnp_dstref,
1394                                                                                                                         &pinfo->src ,
1395                                                                                                                         aarq_data->cv);
1396
1397                 }else { /* no conversation found  */
1398                         /* as CC contains srcref *and* dstref we use both to create new records  */
1399                         create_atn_conversation(&pinfo->src,
1400                                                                                                                         pinfo->clnp_srcref,
1401                                                                                                                         &pinfo->dst ,
1402                                                                                                                         aarq_data->cv);
1403                         create_atn_conversation(&pinfo->dst,
1404                                                                                                                         pinfo->clnp_dstref,
1405                                                                                                                         &pinfo->src ,
1406                                                                                                                         aarq_data->cv);
1407                 }
1408         }
1409
1410         /* clear aarq data */
1411         memset(aarq_data,0,sizeof(aarq_data_t));
1412         aarq_data-> aarq_pending  =  FALSE;
1413
1414           offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
1415                                    ett_atn_ulcs_AARE_apdu, AARE_apdu_sequence);
1416
1417
1418
1419
1420   return offset;
1421 }
1422
1423
1424 static const value_string atn_ulcs_Release_request_reason_vals[] = {
1425   {   0, "normal" },
1426   {   1, "urgent" },
1427   {  30, "user-defined" },
1428   { 0, NULL }
1429 };
1430
1431
1432 static int
1433 dissect_atn_ulcs_Release_request_reason(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1434  /* extension present: last param set to true. asn2wrs didn't take notice of that */
1435  offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
1436                                                             0U, 30U, NULL, TRUE);
1437
1438   return offset;
1439 }
1440
1441
1442 static const per_sequence_t RLRQ_apdu_sequence[] = {
1443   { &hf_atn_ulcs_rlrq_apdu_request_reason, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_Release_request_reason },
1444   { &hf_atn_ulcs_user_information, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_Association_information },
1445   { NULL, 0, 0, NULL }
1446 };
1447
1448 static int
1449 dissect_atn_ulcs_RLRQ_apdu(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1450   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
1451                                    ett_atn_ulcs_RLRQ_apdu, RLRQ_apdu_sequence);
1452
1453   return offset;
1454 }
1455
1456
1457 static const value_string atn_ulcs_Release_response_reason_vals[] = {
1458   {   0, "normal" },
1459   {   1, "not-finished" },
1460   {  30, "user-defined" },
1461   { 0, NULL }
1462 };
1463
1464
1465 static int
1466 dissect_atn_ulcs_Release_response_reason(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1467
1468  /* extension present: last param set to true. asn2wrs didn't take notice of that */
1469  offset = dissect_per_constrained_integer(
1470                 tvb,
1471                 offset,
1472                 actx,
1473                 tree,
1474                 hf_index,
1475                 0U,
1476                 30U,
1477                 NULL,
1478                 TRUE);
1479
1480
1481   return offset;
1482 }
1483
1484
1485 static const per_sequence_t RLRE_apdu_sequence[] = {
1486   { &hf_atn_ulcs_rlre_apdu_response_reason, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_Release_response_reason },
1487   { &hf_atn_ulcs_user_information, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_Association_information },
1488   { NULL, 0, 0, NULL }
1489 };
1490
1491 static int
1492 dissect_atn_ulcs_RLRE_apdu(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1493   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
1494                                    ett_atn_ulcs_RLRE_apdu, RLRE_apdu_sequence);
1495
1496   return offset;
1497 }
1498
1499
1500 static const value_string atn_ulcs_ABRT_source_vals[] = {
1501   {   0, "acse-service-user" },
1502   {   1, "acse-service-provider" },
1503   { 0, NULL }
1504 };
1505
1506
1507 static int
1508 dissect_atn_ulcs_ABRT_source(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1509   offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
1510                                                             0U, 1U, NULL, TRUE);
1511
1512   return offset;
1513 }
1514
1515
1516 static const value_string atn_ulcs_ABRT_diagnostic_vals[] = {
1517   {   1, "no-reason-given" },
1518   {   2, "protocol-error" },
1519   {   3, "authentication-mechanism-name-not-recognized" },
1520   {   4, "authentication-mechanism-name-required" },
1521   {   5, "authentication-failure" },
1522   {   6, "authentication-required" },
1523   { 0, NULL }
1524 };
1525
1526 static guint32 ABRT_diagnostic_value_map[6+0] = {1, 2, 3, 4, 5, 6};
1527
1528 static int
1529 dissect_atn_ulcs_ABRT_diagnostic(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1530   offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
1531                                      6, NULL, TRUE, 0, ABRT_diagnostic_value_map);
1532
1533   return offset;
1534 }
1535
1536
1537 static const per_sequence_t ABRT_apdu_sequence[] = {
1538   { &hf_atn_ulcs_abort_source, ASN1_EXTENSION_ROOT    , ASN1_NOT_OPTIONAL, dissect_atn_ulcs_ABRT_source },
1539   { &hf_atn_ulcs_abort_diagnostic, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_ABRT_diagnostic },
1540   { &hf_atn_ulcs_user_information, ASN1_EXTENSION_ROOT    , ASN1_OPTIONAL    , dissect_atn_ulcs_Association_information },
1541   { NULL, 0, 0, NULL }
1542 };
1543
1544 static int
1545 dissect_atn_ulcs_ABRT_apdu(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1546   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
1547                                    ett_atn_ulcs_ABRT_apdu, ABRT_apdu_sequence);
1548
1549   return offset;
1550 }
1551
1552
1553 static const value_string atn_ulcs_ACSE_apdu_vals[] = {
1554   {   0, "aarq" },
1555   {   1, "aare" },
1556   {   2, "rlrq" },
1557   {   3, "rlre" },
1558   {   4, "abrt" },
1559   { 0, NULL }
1560 };
1561
1562 static const per_choice_t ACSE_apdu_choice[] = {
1563   {   0, &hf_atn_ulcs_aarq       , ASN1_EXTENSION_ROOT    , dissect_atn_ulcs_AARQ_apdu },
1564   {   1, &hf_atn_ulcs_aare       , ASN1_EXTENSION_ROOT    , dissect_atn_ulcs_AARE_apdu },
1565   {   2, &hf_atn_ulcs_rlrq       , ASN1_EXTENSION_ROOT    , dissect_atn_ulcs_RLRQ_apdu },
1566   {   3, &hf_atn_ulcs_rlre       , ASN1_EXTENSION_ROOT    , dissect_atn_ulcs_RLRE_apdu },
1567   {   4, &hf_atn_ulcs_abrt       , ASN1_EXTENSION_ROOT    , dissect_atn_ulcs_ABRT_apdu },
1568   { 0, NULL, 0, NULL }
1569 };
1570
1571 static int
1572 dissect_atn_ulcs_ACSE_apdu(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1573   offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
1574                                  ett_atn_ulcs_ACSE_apdu, ACSE_apdu_choice,
1575                                  NULL);
1576
1577   return offset;
1578 }
1579
1580 /*--- PDUs ---*/
1581
1582 static void dissect_Fully_encoded_data_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
1583   asn1_ctx_t asn1_ctx;
1584   asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, FALSE, pinfo);
1585   dissect_atn_ulcs_Fully_encoded_data(tvb, 0, &asn1_ctx, tree, hf_atn_ulcs_Fully_encoded_data_PDU);
1586 }
1587 static void dissect_ACSE_apdu_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
1588   asn1_ctx_t asn1_ctx;
1589   asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, FALSE, pinfo);
1590   dissect_atn_ulcs_ACSE_apdu(tvb, 0, &asn1_ctx, tree, hf_atn_ulcs_ACSE_apdu_PDU);
1591 }
1592
1593
1594 /*--- End of included file: packet-atn-ulcs-fn.c ---*/
1595 #line 200 "../../asn1/atn-ulcs/packet-atn-ulcs-template.c"
1596
1597 #if 0
1598 /* re-implementing external data: packet-per.c */
1599 static const value_string per_External_encoding_vals[] = {
1600 {   0, "single-ASN1-type" },
1601 {   1, "octet-aligned" },
1602 {   2, "arbitrary" },
1603 { 0, NULL }
1604 };
1605
1606 /* re-implementing external data: packet-per.c */
1607 static const per_choice_t External_encoding_choice[] =
1608 {
1609                 {               0,
1610                                 &hf_atn_ulcs_externalt_encoding_single_asn1_type,
1611                                 ASN1_NO_EXTENSIONS,
1612                                 dissect_atn_ulcs_T_externalt_encoding_single_asn1_type
1613                 },
1614                 {               1,
1615                                 &hf_atn_ulcs_externalt_encoding_octet_aligned,
1616                                 ASN1_NO_EXTENSIONS,
1617                                 dissect_atn_ulcs_T_externalt_encoding_octet_aligned
1618                 },
1619                 {               2,
1620                                 &hf_atn_ulcs_externalt_encoding_arbitrary,
1621                                 ASN1_NO_EXTENSIONS,
1622                                 dissect_atn_ulcs_T_externalt_encoding_arbitrary
1623                 },
1624                 {               0,
1625                                 NULL,
1626                                 0,
1627                                 NULL
1628                 }
1629 };
1630 #endif
1631
1632 /* ATN Session layer */
1633 #define SES_PDU_TYPE_MASK                       0xf8
1634 #define SES_PARAM_IND_MASK                      0x04
1635 #define SES_PARAM_B2_MASK                       0x02
1636 #define SES_PARAM_B1_MASK                       0x01
1637
1638 static int hf_atn_ses_type = -1;
1639 static int hf_atn_ses_param_ind = -1;
1640 static int hf_atn_ses_param_b1 = -1;
1641 static int hf_atn_ses_param_b2 = -1;
1642
1643 static gint ett_atn_ses = -1;
1644
1645 #define ATN_SES_PROTO "ICAO Doc9705 ULCS Session (ISO 8326/8327-1:1994)"
1646
1647 const value_string atn_ses_param_ind[] =
1648 {
1649                 {0,     "No Parameter Indication "},
1650                 {1,     "Parameter Indication "},
1651                 {0,     NULL }
1652 };
1653
1654 const value_string srf_b2[] =
1655 {
1656                 {0,     "Transport Connection is kept"},
1657                 {1,     "Transport Connection is released" },
1658                 {0,     NULL }
1659 };
1660
1661 const value_string srf_b1[] =
1662 {
1663                 {0,     "Transport Connection is transient"},
1664                 {1,     "Transport Connection is persistent"},
1665                 {0,     NULL }
1666 };
1667
1668 #define SES_ATN_SCN                             0xe8
1669 #define SES_ATN_SCNC                    0xf8
1670 #define SES_ATN_SAC                             0xf0
1671 #define SES_ATN_SACC                    0xd8
1672 #define SES_ATN_SRF                             0xe0
1673 #define SES_ATN_SRFC                    0xa0
1674
1675 const value_string atn_ses_type[] =
1676 {
1677                 { 0x1d, "Short Connect (SCN) SPDU" },
1678                 { 0x1f, "Short Connect Accept (SAC) SPDU" },
1679                 { 0x1e, "Short Connect Accept Continue (SACC) SPDU" },
1680                 { 0x1c, "Short Refuse (SRF) SPDU" },
1681                 { 0x14, "Short Refuse Continue (SRFC) SPDU" },
1682                 {0,     NULL }
1683 };
1684
1685 /* ATN Presentation layer */
1686 #define ATN_PRES_PROTO "ICAO Doc9705 ULCS Presentation (ISO 8822/8823-1:1994)"
1687
1688 static int hf_atn_pres_err       = -1;
1689 static gint ett_atn_pres                = -1;
1690
1691 #define ATN_SES_PRES_MASK 0xf803
1692 #define PRES_CPR_ER_MASK                0x70
1693
1694 /* type determined by SPDU and PPDU */
1695 const value_string atn_pres_vals[] =
1696 {
1697                 { 0xe802, "Short Presentation Connect PPDU (CP) " },
1698                 { 0xf802, "Short Presentation Connect PPDU (CP) " },
1699                 { 0xf002, "Short Presentation Connect Accept PPDU (CPA)" },
1700                 { 0xd802, "Short Presentation Connect Accept PPDU (CPA)" },
1701                 { 0xe002, "Short Presentation Connect Reject PPDU (CPR)" },
1702                 { 0xa002, "Short Presentation Connect Reject PPDU (CPR)" },
1703                 {0,                                     NULL }
1704 };
1705
1706 /* Short Presentation Connect Reject PPDU's 0yyy 00zz */
1707 const value_string atn_pres_err[] =
1708 {
1709                 { 0x00, "Presentation-user" },
1710                 { 0x01, "Reason not specified (transient)"},
1711                 { 0x02, "Temporary congestion (transient)"},
1712                 { 0x03, "Local limit exceeded (transient)"},
1713                 { 0x04, "Called presentation-address unknown (permanent)"},
1714                 { 0x05, "Protocol version not supported (permanent)"},
1715                 { 0x06, "Default context not supported (permanent)"},
1716                 { 0x07, "User data not readable (permanent)"},
1717                 { 0,                                    NULL }
1718 };
1719
1720 #if 0
1721 /* re-implementing external data: packet-per.c */
1722 static int      atn_ulcs_Externalt_encoding(
1723                 tvbuff_t *tvb _U_,
1724                 int offset _U_,
1725                 asn1_ctx_t *actx _U_,
1726                 proto_tree *tree _U_,
1727                 int hf_index _U_)
1728 {
1729                 offset = dissect_per_choice(
1730                                 tvb,
1731                                 offset,
1732                                 actx,
1733                                 tree,
1734                                 hf_index,
1735                                 ett_atn_ulcs_EXTERNALt,
1736                                 External_encoding_choice,
1737                                 &actx->external.encoding);
1738
1739                 return offset;
1740 }
1741
1742 /* re-implementing external data: packet-per.c */
1743 static guint32  atn_per_external_type(
1744                 tvbuff_t *tvb _U_,
1745                 guint32 offset,
1746                 asn1_ctx_t *actx,
1747                 proto_tree *tree _U_,
1748                 int hf_index _U_,
1749                 per_type_fn type_cb)
1750 {
1751                 memset(&actx->external, '\0', sizeof(actx->external));
1752                 actx->external.hf_index = -1;
1753                 actx->external.encoding = -1;
1754
1755                 actx->external.u.per.type_cb = type_cb;
1756                 offset = atn_ulcs_Externalt_encoding(
1757                                 tvb,
1758                                 offset,
1759                                 actx,
1760                                 tree,
1761                                 hf_index);
1762
1763                 memset(
1764                                 &actx->external,
1765                                 '\0',
1766                                 sizeof(actx->external));
1767
1768                 actx->external.hf_index = -1;
1769                 actx->external.encoding = -1;
1770
1771                 return offset;
1772 }
1773 #endif
1774
1775 /* determine 24-bit aircraft address(ARS) */
1776 /* from 20-byte ATN NSAP. */
1777 guint32 get_aircraft_24_bit_address_from_nsap(
1778                 packet_info *pinfo)
1779 {
1780                 const guint8* addr = NULL;
1781                 guint32 ars =0;
1782                 guint32 adr_prefix =0;
1783
1784                 /* check NSAP address type*/
1785                 if( (pinfo->src.type != AT_OSI) ||
1786                                 (pinfo->dst.type != AT_OSI)) {
1787                                 return ars; }
1788
1789                 /* 20 octets address length required */
1790                 /* for ATN */
1791                 if( (pinfo->src.len != 20) ||
1792                                 (pinfo->dst.len != 20)) {
1793                                 return ars; }
1794
1795                 /* first try source address */
1796                 /* if the src address originates */
1797                 /* from an aircraft it's downlink */
1798
1799                 /* convert addr into 32-bit integer */
1800                 addr = (const guint8 *)pinfo->src.data;
1801                 adr_prefix =
1802                                 ((addr[0]<<24) |
1803                                 (addr[1]<<16) |
1804                                 (addr[2]<<8) |
1805                                 addr[3] );
1806
1807                 /* according to ICAO doc9507 Ed2 SV5  */
1808                 /* clause 5.4.3.8.1.5 and  5.4.3.8.1.3 */
1809                 /* mobile addresses contain "c1" of "41" */
1810                 /* in the VER subfield of the NSAP */
1811                 if((adr_prefix == 0x470027c1) ||
1812                                 (adr_prefix == 0x47002741)) {
1813                         /* ICAO doc9507 Ed2 SV5 5.4.3.8.4.4 */
1814                         /* states that the ARS subfield containes */
1815                         /* the  24-bitaddress of the aircraft */
1816                                 ars = ((addr[8])<<16) |
1817                                                 ((addr[9])<<8) |
1818                                                 (addr[10]);
1819                 }
1820
1821                 /* try destination address */
1822                 /* if the src address originates */
1823                 /* from an aircraft it's downlink */
1824
1825                 /* convert addr into 32-bit integer */
1826                 addr = (const guint8 *)pinfo->dst.data;
1827                 adr_prefix = ((addr[0]<<24) |
1828                                 (addr[1]<<16) |
1829                                 (addr[2]<<8) |
1830                                 addr[3] );
1831
1832                 /* according to ICAO doc9507 Ed2 SV5  */
1833                 /* clause 5.4.3.8.1.5 and  5.4.3.8.1.3 */
1834                 /* mobile addresses contain "c1" of "41" */
1835                 /* in the VER subfield of the NSAP */
1836                 if((adr_prefix == 0x470027c1) ||
1837                                 (adr_prefix == 0x47002741)) {
1838                         /* ICAO doc9507 Ed2 SV5 5.4.3.8.4.4 */
1839                         /* states that the ARS subfield containes */
1840                         /* the  24-bitaddress of the aircraft */
1841                         ars = ((addr[8])<<16) |
1842                                                 ((addr[9])<<8) |
1843                                                 (addr[10]);
1844                 }
1845                 return ars;
1846 }
1847
1848 /* determine whether a PDU is uplink or downlink */
1849 /* by checking for known aircraft  address prefices*/
1850 int check_heur_msg_type(packet_info *pinfo  _U_)
1851 {
1852                 int t = no_msg;
1853                 const guint8* addr = NULL;
1854                 guint32 adr_prefix =0;
1855
1856                 /* check NSAP address type*/
1857                 if( (pinfo->src.type != AT_OSI) || (pinfo->dst.type != AT_OSI)) {
1858                                 return t; }
1859
1860                 /* check NSAP address length; 20 octets address length required */
1861                 if( (pinfo->src.len != 20) || (pinfo->dst.len != 20)) {
1862                                 return t; }
1863
1864                 addr = (const guint8 *)pinfo->src.data;
1865
1866                 /* convert address to 32-bit integer  */
1867                 adr_prefix = ((addr[0]<<24) | (addr[1]<<16) | (addr[2]<<8) | addr[3] );
1868
1869                 /* According to the published ATN NSAP adddressing scheme */
1870                 /* in ICAO doc9705 Ed2 SV5 5.4.3.8.1.3 and 5.4.3.8.1.5  */
1871                 /* the "VER" field shall be 0x41 ("all Mobile AINSC") or */
1872                 /* 0xc1 ("all Mobile ATSC") for mobile stations (aka aircraft).*/
1873                 if((adr_prefix == 0x470027c1) || (adr_prefix == 0x47002741)) {
1874                                 t = dm; /* source is an aircraft: it's a downlink PDU */
1875                 }
1876
1877                 addr = (const guint8 *)pinfo->dst.data;
1878
1879                 /* convert address to 32-bit integer  */
1880                 adr_prefix = ((addr[0]<<24) | (addr[1]<<16) | (addr[2]<<8) | addr[3] );
1881
1882                 /* According to the published ATN NSAP adddressing scheme */
1883                 /* in ICAO doc9705 Ed2 SV5 5.4.3.8.1.3 and 5.4.3.8.1.5  */
1884                 /* the "VER" field shall be 0x41 ("all Mobile AINSC") or */
1885                 /* 0xc1 ("all Mobile ATSC") for mobile stations (aka aircraft).*/
1886                 if((adr_prefix == 0x470027c1) || (adr_prefix == 0x47002741)) {
1887                                 t = um; /* destination is aircraft: uplink PDU */
1888                 }
1889
1890                 return t;
1891 }
1892
1893 /* conversation may be used by other dissectors  */
1894 wmem_tree_t *get_atn_conversation_tree(void){
1895                 return atn_conversation_tree;
1896 }
1897
1898
1899 /* find a atn conversation tree node by an endpoint  */
1900 /* an endpoint is identified by atn src and dst addresses */
1901 /* and srcref or dstref (depends on the transport packet type) */
1902 /* IMHO it's a hack - conversations should be maintained */
1903 /* at transport layer (cotp) but this isn't working yet. */
1904 atn_conversation_t * find_atn_conversation(
1905                 address *address1,
1906                 guint16 clnp_ref1,
1907                 address *address2 )
1908 {
1909                 atn_conversation_t *cv = NULL;
1910                 guint32 key = 0;
1911                 guint32 tmp = 0;
1912
1913                 ADD_ADDRESS_TO_HASH( tmp, address1);
1914                 key = (tmp << 16) | clnp_ref1 ;
1915
1916                 ADD_ADDRESS_TO_HASH( tmp, address2);
1917                 key = (tmp << 24) | key ;
1918
1919                 /* search for atn conversation */
1920                 cv = (atn_conversation_t *)
1921                                 wmem_tree_lookup32(get_atn_conversation_tree(),key);
1922
1923                 return cv;
1924 }
1925
1926 /* create a atn conversation tree node  */
1927 /* conversation data is to be allocated externally */
1928 /* a conversation may be referenced from both endpoints */
1929 atn_conversation_t * create_atn_conversation(
1930                 address *address1,
1931                 guint16 clnp_ref1,
1932                 address *address2,
1933                 atn_conversation_t *conversation)
1934 {
1935                 atn_conversation_t *cv = NULL;
1936                 guint32 key = 0;
1937                 guint32 tmp = 0;
1938
1939                 ADD_ADDRESS_TO_HASH( tmp, address1);
1940                 key = (tmp << 16) | clnp_ref1 ;
1941
1942                 ADD_ADDRESS_TO_HASH( tmp, address2);
1943                 key = (tmp << 24) | key ;
1944
1945                 /* search for aircraft entry */
1946                 cv = (atn_conversation_t *)
1947                 wmem_tree_lookup32(
1948                                 get_atn_conversation_tree(),
1949                                 key);
1950
1951                 /* tree node  already present  */
1952                 if(cv) {
1953                         return NULL; }
1954
1955                 /* insert conversation data in tree*/
1956                 wmem_tree_insert32(
1957                                 get_atn_conversation_tree(),
1958                                 key,
1959                                 (void*)conversation);
1960
1961                 return conversation;
1962 }
1963
1964 static int
1965 dissect_atn_ulcs(
1966                 tvbuff_t *tvb,
1967                 packet_info *pinfo,
1968                 proto_tree *tree,
1969                 void *data _U_)
1970 {
1971                 int offset = 0;
1972                 proto_item *ti = NULL;
1973                 proto_tree *atn_ulcs_tree = NULL;
1974                 guint8 value_pres = 0;
1975                 guint8 value_ses = 0;
1976                 guint16 value_ses_pres = 0;
1977
1978                 root_tree = tree;
1979
1980                 /* data pointer */
1981                 /* decode as PDV-list */
1982                 if ( (int)(intptr_t)  data == FALSE )
1983                 {
1984                                 ti = proto_tree_add_item(
1985                                                 tree,
1986                                                 proto_atn_ulcs,
1987                                                 tvb,
1988                                                 0,
1989                                                 0 ,
1990                                                 FALSE);
1991
1992                                 atn_ulcs_tree = proto_item_add_subtree(
1993                                                 ti,
1994                                                 ett_atn_ulcs);
1995
1996                                 dissect_Fully_encoded_data_PDU(
1997                                                 tvb,
1998                                                 pinfo,
1999                                                 atn_ulcs_tree);
2000
2001                                 return offset +
2002                                         tvb_reported_length_remaining(tvb, offset ) ;
2003                 }
2004
2005                 /* decode as SPDU, PPDU and ACSE PDU */
2006                 if ( (int)(intptr_t)  data == TRUE )
2007                 {
2008                                 /* get session and presentation PDU's */
2009                                 value_ses_pres = tvb_get_ntohs(tvb, offset);
2010
2011                                 /* SPDU: dissect session layer */
2012                                 ti = proto_tree_add_text(
2013                                                 tree,
2014                                                 tvb,
2015                                                 offset,
2016                                                 0,
2017                                                 ATN_SES_PROTO );
2018
2019                                 atn_ulcs_tree = proto_item_add_subtree(
2020                                                 ti,
2021                                                 ett_atn_ses);
2022
2023                                 /* get SPDU (1 octet) */
2024                                 value_ses = tvb_get_guint8(tvb, offset);
2025
2026                                 /* SPDU type/identifier  */
2027                                 proto_tree_add_item(atn_ulcs_tree,
2028                                                 hf_atn_ses_type,
2029                                                 tvb,
2030                                                 offset,
2031                                                 1,
2032                                                 ENC_BIG_ENDIAN );
2033
2034                                 /* SPDU parameters may be present in Short Refuse */
2035                                 /* or Short Refuse Continue SPDU's */
2036                                 switch(value_ses & SES_PDU_TYPE_MASK){
2037                                                 case SES_ATN_SRF:
2038                                                 case SES_ATN_SRFC:
2039
2040                                                                 /* SPDU parameter presence */
2041                                                                 proto_tree_add_item(atn_ulcs_tree,
2042                                                                                 hf_atn_ses_param_ind,
2043                                                                                 tvb,
2044                                                                                 offset,
2045                                                                                 1,
2046                                                                                 ENC_BIG_ENDIAN );
2047
2048                                                                 /* parameter B2 */
2049                                                                 proto_tree_add_item(atn_ulcs_tree,
2050                                                                                 hf_atn_ses_param_b2,
2051                                                                                 tvb,
2052                                                                                 offset,
2053                                                                                 1,
2054                                                                                 ENC_BIG_ENDIAN );
2055
2056                                                                 /* parameter B1 */
2057                                                                 proto_tree_add_item(atn_ulcs_tree,
2058                                                                                 hf_atn_ses_param_b1,
2059                                                                                 tvb,
2060                                                                                 offset,
2061                                                                                 1,
2062                                                                                 ENC_BIG_ENDIAN );
2063
2064                                                         break;
2065                                                 default:
2066                                                         break;
2067                                 }
2068                                 offset++;
2069
2070                                 /* PPDU: dissect presentation layer */
2071                                 ti = proto_tree_add_text(
2072                                                 tree,
2073                                                 tvb,
2074                                                 offset,
2075                                                 0,
2076                                                 ATN_PRES_PROTO );
2077
2078                                 atn_ulcs_tree = proto_item_add_subtree(ti, ett_atn_pres);
2079
2080                                 value_pres = tvb_get_guint8(tvb, offset);
2081
2082                                 /* need session context to identify PPDU type */
2083                                 /* note: */
2084                                 /* it is *unfeasible* to use proto_tree_add_item here: */
2085                                 /* presentation type is always the same constant but its type */
2086                                 /* is implicitly determined by preceding session context */
2087                                 proto_tree_add_text(atn_ulcs_tree,
2088                                                 tvb,
2089                                                 offset,
2090                                                 1,
2091                                                 "%s (0x%02x)",
2092                                                 val_to_str( value_ses_pres & ATN_SES_PRES_MASK , atn_pres_vals, "?"),
2093                                                 value_pres);
2094
2095                                 /* PPDU errorcode in case of SRF/CPR */
2096                                 switch(value_ses & SES_PDU_TYPE_MASK){
2097                                                 case SES_ATN_SRF:
2098                                                 case SES_ATN_SRFC:
2099                                                                 proto_tree_add_item(
2100                                                                                 atn_ulcs_tree,
2101                                                                                 hf_atn_pres_err,
2102                                                                                 tvb,
2103                                                                                 offset,
2104                                                                                 1,
2105                                                                                 ENC_BIG_ENDIAN );
2106                                                                 break;
2107                                                 default:
2108                                                                 break;
2109                                 }
2110
2111                                 offset++;
2112
2113                                 /* ACSE PDU: dissect application layer */
2114                                 ti = proto_tree_add_text(
2115                                                 tree,
2116                                                 tvb,
2117                                                 offset,
2118                                                 0,
2119                                                 ATN_ACSE_PROTO );
2120
2121                                 atn_ulcs_tree = proto_item_add_subtree(
2122                                                 ti,
2123                                                 ett_atn_acse);
2124
2125                                 dissect_ACSE_apdu_PDU(
2126                                                 tvb_new_subset_remaining(tvb, offset),
2127                                                 pinfo,
2128                                                 atn_ulcs_tree);
2129
2130                                 return offset +
2131                                                 tvb_reported_length_remaining(tvb, offset );
2132                 }
2133                 return offset;
2134 }
2135
2136 static gboolean dissect_atn_ulcs_heur(
2137                 tvbuff_t *tvb,
2138                 packet_info *pinfo,
2139                 proto_tree *tree,
2140                 void *data _U_)
2141 {
2142                 /* do we have enough data*/
2143                 /* at least session + presentation data or pdv-list */
2144                 if (tvb_length(tvb) < 2){
2145                                 return FALSE; }
2146
2147                 /* check for session/presentation/ACSE PDU's  */
2148                 /* SPDU and PPDU are one octet each */
2149                 switch( tvb_get_ntohs(tvb, 0) & 0xf8ff ){
2150                                 case 0xe802: /* SCN + CP*/
2151                                 case 0xf802: /* SCNC + CP */
2152                                 case 0xf002: /* SAC + CPA */
2153                                 case 0xd802: /* SACC + CPA */
2154                                 case 0xe002: /* SRF + CPR + R0 */
2155                                 case 0xe012: /* SRF + CPR + R1 */
2156                                 case 0xe022: /* SRF + CPR + R2 */
2157                                 case 0xe032: /* SRF + CPR + R3 */
2158                                 case 0xe042: /* SRF + CPR + R4 */
2159                                 case 0xe052: /* SRF + CPR + R5 */
2160                                 case 0xe062: /* SRF + CPR + R6 */
2161                                 case 0xe072: /* SRF + CPR + R7 */
2162                                 case 0xa002: /* SRFC + CPR + R0*/
2163                                 case 0xa012: /* SRFC + CPR + R1*/
2164                                 case 0xa022: /* SRFC + CPR + R2*/
2165                                 case 0xa032: /* SRFC + CPR + R3*/
2166                                 case 0xa042: /* SRFC + CPR + R4*/
2167                                 case 0xa052: /* SRFC + CPR + R5*/
2168                                 case 0xa062: /* SRFC + CPR + R6*/
2169                                 case 0xa072: /* SRFC + CPR + R7*/
2170                                                 /* indicate to dissector routine */
2171                                                 /* that a least SPDU, PPDU and */
2172                                                 /* ACSE PDU is present */
2173                                                 dissect_atn_ulcs(
2174                                                                 tvb,
2175                                                                 pinfo,
2176                                                                 tree,
2177                                                                 (void*) TRUE);
2178                                                 return TRUE;
2179                                 default:        /* no SPDU */
2180                                                 break;
2181                 }
2182
2183                 /* try to detect "Fully-encoded-data" heuristically */
2184                 /* the constants listed match the ASN.1 PER encoding */
2185                 /* of PDV-List */
2186                 switch(  tvb_get_ntohs(tvb, 0) & 0xfff0 ){
2187                                 case 0x0020: /* acse-apdu */
2188                                 case 0x00a0: /* user-ase-apdu */
2189                                 /* indicate to dissector routine */
2190                                 /* that a PDV-list PDU is present */
2191                                 /*  */
2192                                 /* PDV-list PDU may contain */
2193                                 /* application protocol data (CM, CPDLC) */
2194                                 /* or an ACSE PDU */
2195                                                 dissect_atn_ulcs(tvb, pinfo, tree, (void*) FALSE);
2196                                                 return TRUE;
2197                                                 break;
2198                                 default:        /* no or unsupported PDU */
2199                                                 break;
2200                 }
2201                 return FALSE;
2202 }
2203
2204 void proto_register_atn_ulcs (void)
2205 {
2206                 static hf_register_info hf_atn_ulcs[] = {
2207
2208 /*--- Included file: packet-atn-ulcs-hfarr.c ---*/
2209 #line 1 "../../asn1/atn-ulcs/packet-atn-ulcs-hfarr.c"
2210     { &hf_atn_ulcs_Fully_encoded_data_PDU,
2211       { "Fully-encoded-data", "atn-ulcs.Fully_encoded_data",
2212         FT_UINT32, BASE_DEC, NULL, 0,
2213         NULL, HFILL }},
2214     { &hf_atn_ulcs_ACSE_apdu_PDU,
2215       { "ACSE-apdu", "atn-ulcs.ACSE_apdu",
2216         FT_UINT32, BASE_DEC, VALS(atn_ulcs_ACSE_apdu_vals), 0,
2217         NULL, HFILL }},
2218     { &hf_atn_ulcs_Fully_encoded_data_item,
2219       { "PDV-list", "atn-ulcs.PDV_list_element",
2220         FT_NONE, BASE_NONE, NULL, 0,
2221         NULL, HFILL }},
2222     { &hf_atn_ulcs_transfer_syntax_name,
2223       { "transfer-syntax-name", "atn-ulcs.transfer_syntax_name",
2224         FT_OID, BASE_NONE, NULL, 0,
2225         NULL, HFILL }},
2226     { &hf_atn_ulcs_presentation_context_identifier,
2227       { "presentation-context-identifier", "atn-ulcs.presentation_context_identifier",
2228         FT_UINT32, BASE_DEC, VALS(atn_ulcs_Presentation_context_identifier_vals), 0,
2229         NULL, HFILL }},
2230     { &hf_atn_ulcs_presentation_data_values,
2231       { "presentation-data-values", "atn-ulcs.presentation_data_values",
2232         FT_UINT32, BASE_DEC, VALS(atn_ulcs_T_presentation_data_values_vals), 0,
2233         NULL, HFILL }},
2234     { &hf_atn_ulcs_pdv_list_presentation_data_values_single_asn1_type,
2235       { "single-ASN1-type", "atn-ulcs.single_ASN1_type_element",
2236         FT_NONE, BASE_NONE, NULL, 0,
2237         "T_pdv_list_presentation_data_values_single_asn1_type", HFILL }},
2238     { &hf_atn_ulcs_octet_aligned,
2239       { "octet-aligned", "atn-ulcs.octet_aligned",
2240         FT_BYTES, BASE_NONE, NULL, 0,
2241         "OCTET_STRING", HFILL }},
2242     { &hf_atn_ulcs_pdv_list_presentation_data_values_arbitrary,
2243       { "arbitrary", "atn-ulcs.arbitrary",
2244         FT_BYTES, BASE_NONE, NULL, 0,
2245         "T_pdv_list_presentation_data_values_arbitrary", HFILL }},
2246     { &hf_atn_ulcs_direct_reference,
2247       { "direct-reference", "atn-ulcs.direct_reference",
2248         FT_OID, BASE_NONE, NULL, 0,
2249         "OBJECT_IDENTIFIER", HFILL }},
2250     { &hf_atn_ulcs_indirect_reference,
2251       { "indirect-reference", "atn-ulcs.indirect_reference",
2252         FT_INT32, BASE_DEC, NULL, 0,
2253         "INTEGER", HFILL }},
2254     { &hf_atn_ulcs_data_value_descriptor,
2255       { "data-value-descriptor", "atn-ulcs.data_value_descriptor",
2256         FT_STRING, BASE_NONE, NULL, 0,
2257         NULL, HFILL }},
2258     { &hf_atn_ulcs_encoding,
2259       { "encoding", "atn-ulcs.encoding",
2260         FT_UINT32, BASE_DEC, VALS(atn_ulcs_T_encoding_vals), 0,
2261         NULL, HFILL }},
2262     { &hf_atn_ulcs_externalt_encoding_single_asn1_type,
2263       { "single-ASN1-type", "atn-ulcs.single_ASN1_type_element",
2264         FT_NONE, BASE_NONE, NULL, 0,
2265         "T_externalt_encoding_single_asn1_type", HFILL }},
2266     { &hf_atn_ulcs_externalt_encoding_octet_aligned,
2267       { "octet-aligned", "atn-ulcs.octet_aligned",
2268         FT_BYTES, BASE_NONE, NULL, 0,
2269         "T_externalt_encoding_octet_aligned", HFILL }},
2270     { &hf_atn_ulcs_externalt_encoding_arbitrary,
2271       { "arbitrary", "atn-ulcs.arbitrary",
2272         FT_BYTES, BASE_NONE, NULL, 0,
2273         "T_externalt_encoding_arbitrary", HFILL }},
2274     { &hf_atn_ulcs_aarq,
2275       { "aarq", "atn-ulcs.aarq_element",
2276         FT_NONE, BASE_NONE, NULL, 0,
2277         "AARQ_apdu", HFILL }},
2278     { &hf_atn_ulcs_aare,
2279       { "aare", "atn-ulcs.aare_element",
2280         FT_NONE, BASE_NONE, NULL, 0,
2281         "AARE_apdu", HFILL }},
2282     { &hf_atn_ulcs_rlrq,
2283       { "rlrq", "atn-ulcs.rlrq_element",
2284         FT_NONE, BASE_NONE, NULL, 0,
2285         "RLRQ_apdu", HFILL }},
2286     { &hf_atn_ulcs_rlre,
2287       { "rlre", "atn-ulcs.rlre_element",
2288         FT_NONE, BASE_NONE, NULL, 0,
2289         "RLRE_apdu", HFILL }},
2290     { &hf_atn_ulcs_abrt,
2291       { "abrt", "atn-ulcs.abrt_element",
2292         FT_NONE, BASE_NONE, NULL, 0,
2293         "ABRT_apdu", HFILL }},
2294     { &hf_atn_ulcs_aarq_apdu_protocol_version,
2295       { "protocol-version", "atn-ulcs.protocol_version",
2296         FT_BYTES, BASE_NONE, NULL, 0,
2297         "T_aarq_apdu_protocol_version", HFILL }},
2298     { &hf_atn_ulcs_application_context_name,
2299       { "application-context-name", "atn-ulcs.application_context_name",
2300         FT_OID, BASE_NONE, NULL, 0,
2301         NULL, HFILL }},
2302     { &hf_atn_ulcs_called_AP_title,
2303       { "called-AP-title", "atn-ulcs.called_AP_title",
2304         FT_UINT32, BASE_DEC, VALS(atn_ulcs_AP_title_vals), 0,
2305         "AP_title", HFILL }},
2306     { &hf_atn_ulcs_called_AE_qualifier,
2307       { "called-AE-qualifier", "atn-ulcs.called_AE_qualifier",
2308         FT_UINT32, BASE_DEC, VALS(atn_ulcs_AE_qualifier_vals), 0,
2309         "AE_qualifier", HFILL }},
2310     { &hf_atn_ulcs_called_AP_invocation_identifier,
2311       { "called-AP-invocation-identifier", "atn-ulcs.called_AP_invocation_identifier",
2312         FT_INT32, BASE_DEC, NULL, 0,
2313         "AP_invocation_identifier", HFILL }},
2314     { &hf_atn_ulcs_called_AE_invocation_identifier,
2315       { "called-AE-invocation-identifier", "atn-ulcs.called_AE_invocation_identifier",
2316         FT_INT32, BASE_DEC, NULL, 0,
2317         "AE_invocation_identifier", HFILL }},
2318     { &hf_atn_ulcs_calling_AP_title,
2319       { "calling-AP-title", "atn-ulcs.calling_AP_title",
2320         FT_UINT32, BASE_DEC, VALS(atn_ulcs_AP_title_vals), 0,
2321         "AP_title", HFILL }},
2322     { &hf_atn_ulcs_calling_AE_qualifier,
2323       { "calling-AE-qualifier", "atn-ulcs.calling_AE_qualifier",
2324         FT_UINT32, BASE_DEC, VALS(atn_ulcs_AE_qualifier_vals), 0,
2325         "AE_qualifier", HFILL }},
2326     { &hf_atn_ulcs_calling_AP_invocation_identifier,
2327       { "calling-AP-invocation-identifier", "atn-ulcs.calling_AP_invocation_identifier",
2328         FT_INT32, BASE_DEC, NULL, 0,
2329         "AP_invocation_identifier", HFILL }},
2330     { &hf_atn_ulcs_calling_AE_invocation_identifier,
2331       { "calling-AE-invocation-identifier", "atn-ulcs.calling_AE_invocation_identifier",
2332         FT_INT32, BASE_DEC, NULL, 0,
2333         "AE_invocation_identifier", HFILL }},
2334     { &hf_atn_ulcs_sender_acse_requirements,
2335       { "sender-acse-requirements", "atn-ulcs.sender_acse_requirements",
2336         FT_BYTES, BASE_NONE, NULL, 0,
2337         "ACSE_requirements", HFILL }},
2338     { &hf_atn_ulcs_mechanism_name,
2339       { "mechanism-name", "atn-ulcs.mechanism_name",
2340         FT_OID, BASE_NONE, NULL, 0,
2341         NULL, HFILL }},
2342     { &hf_atn_ulcs_calling_authentication_value,
2343       { "calling-authentication-value", "atn-ulcs.calling_authentication_value",
2344         FT_UINT32, BASE_DEC, VALS(atn_ulcs_Authentication_value_vals), 0,
2345         "Authentication_value", HFILL }},
2346     { &hf_atn_ulcs_application_context_name_list,
2347       { "application-context-name-list", "atn-ulcs.application_context_name_list",
2348         FT_UINT32, BASE_DEC, NULL, 0,
2349         NULL, HFILL }},
2350     { &hf_atn_ulcs_implementation_information,
2351       { "implementation-information", "atn-ulcs.implementation_information",
2352         FT_BYTES, BASE_NONE, NULL, 0,
2353         "Implementation_data", HFILL }},
2354     { &hf_atn_ulcs_user_information,
2355       { "user-information", "atn-ulcs.user_information",
2356         FT_UINT32, BASE_DEC, NULL, 0,
2357         "Association_information", HFILL }},
2358     { &hf_atn_ulcs_aare_apdu_protocol_version,
2359       { "protocol-version", "atn-ulcs.protocol_version",
2360         FT_BYTES, BASE_NONE, NULL, 0,
2361         "T_aare_apdu_protocol_version", HFILL }},
2362     { &hf_atn_ulcs_result,
2363       { "result", "atn-ulcs.result",
2364         FT_UINT32, BASE_DEC, VALS(atn_ulcs_Associate_result_vals), 0,
2365         "Associate_result", HFILL }},
2366     { &hf_atn_ulcs_result_source_diagnostic,
2367       { "result-source-diagnostic", "atn-ulcs.result_source_diagnostic",
2368         FT_UINT32, BASE_DEC, VALS(atn_ulcs_Associate_source_diagnostic_vals), 0,
2369         "Associate_source_diagnostic", HFILL }},
2370     { &hf_atn_ulcs_responding_AP_title,
2371       { "responding-AP-title", "atn-ulcs.responding_AP_title",
2372         FT_UINT32, BASE_DEC, VALS(atn_ulcs_AP_title_vals), 0,
2373         "AP_title", HFILL }},
2374     { &hf_atn_ulcs_responding_AE_qualifier,
2375       { "responding-AE-qualifier", "atn-ulcs.responding_AE_qualifier",
2376         FT_UINT32, BASE_DEC, VALS(atn_ulcs_AE_qualifier_vals), 0,
2377         "AE_qualifier", HFILL }},
2378     { &hf_atn_ulcs_responding_AP_invocation_identifier,
2379       { "responding-AP-invocation-identifier", "atn-ulcs.responding_AP_invocation_identifier",
2380         FT_INT32, BASE_DEC, NULL, 0,
2381         "AP_invocation_identifier", HFILL }},
2382     { &hf_atn_ulcs_responding_AE_invocation_identifier,
2383       { "responding-AE-invocation-identifier", "atn-ulcs.responding_AE_invocation_identifier",
2384         FT_INT32, BASE_DEC, NULL, 0,
2385         "AE_invocation_identifier", HFILL }},
2386     { &hf_atn_ulcs_responder_acse_requirements,
2387       { "responder-acse-requirements", "atn-ulcs.responder_acse_requirements",
2388         FT_BYTES, BASE_NONE, NULL, 0,
2389         "ACSE_requirements", HFILL }},
2390     { &hf_atn_ulcs_responding_authentication_value,
2391       { "responding-authentication-value", "atn-ulcs.responding_authentication_value",
2392         FT_UINT32, BASE_DEC, VALS(atn_ulcs_Authentication_value_vals), 0,
2393         "Authentication_value", HFILL }},
2394     { &hf_atn_ulcs_rlrq_apdu_request_reason,
2395       { "reason", "atn-ulcs.reason",
2396         FT_UINT32, BASE_DEC, VALS(atn_ulcs_Release_request_reason_vals), 0,
2397         "Release_request_reason", HFILL }},
2398     { &hf_atn_ulcs_rlre_apdu_response_reason,
2399       { "reason", "atn-ulcs.reason",
2400         FT_UINT32, BASE_DEC, VALS(atn_ulcs_Release_response_reason_vals), 0,
2401         "Release_response_reason", HFILL }},
2402     { &hf_atn_ulcs_abort_source,
2403       { "abort-source", "atn-ulcs.abort_source",
2404         FT_UINT32, BASE_DEC, VALS(atn_ulcs_ABRT_source_vals), 0,
2405         "ABRT_source", HFILL }},
2406     { &hf_atn_ulcs_abort_diagnostic,
2407       { "abort-diagnostic", "atn-ulcs.abort_diagnostic",
2408         FT_UINT32, BASE_DEC, VALS(atn_ulcs_ABRT_diagnostic_vals), 0,
2409         "ABRT_diagnostic", HFILL }},
2410     { &hf_atn_ulcs_Application_context_name_list_item,
2411       { "Application-context-name", "atn-ulcs.Application_context_name",
2412         FT_OID, BASE_NONE, NULL, 0,
2413         NULL, HFILL }},
2414     { &hf_atn_ulcs_ap_title_form2,
2415       { "ap-title-form2", "atn-ulcs.ap_title_form2",
2416         FT_OID, BASE_NONE, NULL, 0,
2417         NULL, HFILL }},
2418     { &hf_atn_ulcs_ap_title_form1,
2419       { "ap-title-form1", "atn-ulcs.ap_title_form1",
2420         FT_UINT32, BASE_DEC, VALS(atn_ulcs_Name_vals), 0,
2421         NULL, HFILL }},
2422     { &hf_atn_ulcs_ae_qualifier_form2,
2423       { "ae-qualifier-form2", "atn-ulcs.ae_qualifier_form2",
2424         FT_INT32, BASE_DEC, NULL, 0,
2425         NULL, HFILL }},
2426     { &hf_atn_ulcs_ae_qualifier_form1,
2427       { "ae-qualifier-form1", "atn-ulcs.ae_qualifier_form1",
2428         FT_UINT32, BASE_DEC, NULL, 0,
2429         NULL, HFILL }},
2430     { &hf_atn_ulcs_acse_service_user,
2431       { "acse-service-user", "atn-ulcs.acse_service_user",
2432         FT_UINT32, BASE_DEC, VALS(atn_ulcs_T_acse_service_user_vals), 0,
2433         NULL, HFILL }},
2434     { &hf_atn_ulcs_acse_service_provider,
2435       { "acse-service-provider", "atn-ulcs.acse_service_provider",
2436         FT_UINT32, BASE_DEC, VALS(atn_ulcs_T_acse_service_provider_vals), 0,
2437         NULL, HFILL }},
2438     { &hf_atn_ulcs_Association_information_item,
2439       { "EXTERNALt", "atn-ulcs.EXTERNALt_element",
2440         FT_NONE, BASE_NONE, NULL, 0,
2441         NULL, HFILL }},
2442     { &hf_atn_ulcs_charstring,
2443       { "charstring", "atn-ulcs.charstring",
2444         FT_BYTES, BASE_NONE, NULL, 0,
2445         "OCTET_STRING", HFILL }},
2446     { &hf_atn_ulcs_bitstring,
2447       { "bitstring", "atn-ulcs.bitstring",
2448         FT_BYTES, BASE_NONE, NULL, 0,
2449         "BIT_STRING", HFILL }},
2450     { &hf_atn_ulcs_external,
2451       { "external", "atn-ulcs.external_element",
2452         FT_NONE, BASE_NONE, NULL, 0,
2453         NULL, HFILL }},
2454     { &hf_atn_ulcs_other,
2455       { "other", "atn-ulcs.other_element",
2456         FT_NONE, BASE_NONE, NULL, 0,
2457         NULL, HFILL }},
2458     { &hf_atn_ulcs_other_mechanism_name,
2459       { "other-mechanism-name", "atn-ulcs.other_mechanism_name",
2460         FT_OID, BASE_NONE, NULL, 0,
2461         "OBJECT_IDENTIFIER", HFILL }},
2462     { &hf_atn_ulcs_other_mechanism_value,
2463       { "other-mechanism-value", "atn-ulcs.other_mechanism_value_element",
2464         FT_NONE, BASE_NONE, NULL, 0,
2465         NULL, HFILL }},
2466     { &hf_atn_ulcs_rdnSequence,
2467       { "rdnSequence", "atn-ulcs.rdnSequence",
2468         FT_UINT32, BASE_DEC, NULL, 0,
2469         NULL, HFILL }},
2470     { &hf_atn_ulcs_RDNSequence_item,
2471       { "RelativeDistinguishedName", "atn-ulcs.RelativeDistinguishedName",
2472         FT_UINT32, BASE_DEC, NULL, 0,
2473         NULL, HFILL }},
2474     { &hf_atn_ulcs_RelativeDistinguishedName_item,
2475       { "AttributeTypeAndValue", "atn-ulcs.AttributeTypeAndValue_element",
2476         FT_NONE, BASE_NONE, NULL, 0,
2477         NULL, HFILL }},
2478     { &hf_atn_ulcs_null,
2479       { "null", "atn-ulcs.null_element",
2480         FT_NONE, BASE_NONE, NULL, 0,
2481         NULL, HFILL }},
2482     { &hf_atn_ulcs_T_aarq_apdu_protocol_version_version1,
2483       { "version1", "atn-ulcs.version1",
2484         FT_BOOLEAN, 8, NULL, 0x80,
2485         NULL, HFILL }},
2486     { &hf_atn_ulcs_T_aare_apdu_protocol_version_version1,
2487       { "version1", "atn-ulcs.version1",
2488         FT_BOOLEAN, 8, NULL, 0x80,
2489         NULL, HFILL }},
2490     { &hf_atn_ulcs_ACSE_requirements_authentication,
2491       { "authentication", "atn-ulcs.authentication",
2492         FT_BOOLEAN, 8, NULL, 0x80,
2493         NULL, HFILL }},
2494     { &hf_atn_ulcs_ACSE_requirements_application_context_negotiation,
2495       { "application-context-negotiation", "atn-ulcs.application-context-negotiation",
2496         FT_BOOLEAN, 8, NULL, 0x40,
2497         NULL, HFILL }},
2498
2499 /*--- End of included file: packet-atn-ulcs-hfarr.c ---*/
2500 #line 812 "../../asn1/atn-ulcs/packet-atn-ulcs-template.c"
2501                                 {&hf_atn_ses_type,
2502                                 { "SPDU Type",
2503                                         "atn-ulcs.ses.type",
2504                                         FT_UINT8,
2505                                         BASE_HEX,
2506                                         VALS(atn_ses_type),
2507                                         0xf8,
2508                                         "Indicates presence of session parameters",
2509                                         HFILL}},
2510                                 {&hf_atn_ses_param_ind,
2511                                 { "SPDU Parameter Indication",
2512                                         "atn-ulcs.ses.parameter-indication",
2513                                         FT_UINT8,
2514                                         BASE_HEX,
2515                                         VALS(atn_ses_param_ind),
2516                                         SES_PARAM_IND_MASK,
2517                                         "Indicates presence of session parameters",
2518                                         HFILL}},
2519                         {&hf_atn_ses_param_b1,
2520                                 { "SRF Parameter B1",
2521                                         "atn-ulcs.ses.srf-b1",
2522                                         FT_UINT8,
2523                                         BASE_HEX,
2524                                         VALS(srf_b1),
2525                                         0x01,
2526                                         "Determines if transport connection reject is \
2527                                         transient or persistent",
2528                                         HFILL}},
2529                         {&hf_atn_ses_param_b2,
2530                                 { "SRF Parameter B2",
2531                                         "atn-ulcs.ses.srf-b2",
2532                                         FT_UINT8,
2533                                         BASE_HEX,
2534                                         VALS(srf_b2),
2535                                         0x02,
2536                                         "Determines if transport connection is \
2537                                         retained or released",
2538                                         HFILL}},
2539                         { &hf_atn_pres_err,
2540                                 { "Error Code", "atn-ulcs.pres.cpr-error",
2541                                         FT_UINT8,
2542                                         BASE_HEX,
2543                                         VALS(atn_pres_err),
2544                                         PRES_CPR_ER_MASK,
2545                                         NULL,
2546                                         HFILL}},
2547                 };
2548
2549                 static gint *ett[] = {
2550
2551 /*--- Included file: packet-atn-ulcs-ettarr.c ---*/
2552 #line 1 "../../asn1/atn-ulcs/packet-atn-ulcs-ettarr.c"
2553     &ett_atn_ulcs_Fully_encoded_data,
2554     &ett_atn_ulcs_PDV_list,
2555     &ett_atn_ulcs_T_presentation_data_values,
2556     &ett_atn_ulcs_EXTERNALt,
2557     &ett_atn_ulcs_T_encoding,
2558     &ett_atn_ulcs_ACSE_apdu,
2559     &ett_atn_ulcs_AARQ_apdu,
2560     &ett_atn_ulcs_T_aarq_apdu_protocol_version,
2561     &ett_atn_ulcs_AARE_apdu,
2562     &ett_atn_ulcs_T_aare_apdu_protocol_version,
2563     &ett_atn_ulcs_RLRQ_apdu,
2564     &ett_atn_ulcs_RLRE_apdu,
2565     &ett_atn_ulcs_ABRT_apdu,
2566     &ett_atn_ulcs_ACSE_requirements,
2567     &ett_atn_ulcs_Application_context_name_list,
2568     &ett_atn_ulcs_AP_title,
2569     &ett_atn_ulcs_AE_qualifier,
2570     &ett_atn_ulcs_Associate_source_diagnostic,
2571     &ett_atn_ulcs_Association_information,
2572     &ett_atn_ulcs_Authentication_value,
2573     &ett_atn_ulcs_T_other,
2574     &ett_atn_ulcs_Name,
2575     &ett_atn_ulcs_RDNSequence,
2576     &ett_atn_ulcs_RelativeDistinguishedName,
2577     &ett_atn_ulcs_AttributeTypeAndValue,
2578
2579 /*--- End of included file: packet-atn-ulcs-ettarr.c ---*/
2580 #line 862 "../../asn1/atn-ulcs/packet-atn-ulcs-template.c"
2581                                 &ett_atn_ses,
2582                                 &ett_atn_pres,
2583                                 &ett_atn_acse,
2584                                 &ett_atn_ulcs
2585     };
2586
2587                 proto_atn_ulcs = proto_register_protocol (
2588                                 ATN_ULCS_PROTO ,
2589                                 "ATN-ULCS",
2590                                 "atn-ulcs");
2591
2592                 proto_register_field_array (
2593                                 proto_atn_ulcs,
2594                                 hf_atn_ulcs,
2595                                 array_length(hf_atn_ulcs));
2596
2597                 proto_register_subtree_array (
2598                                 ett,
2599                                 array_length (ett));
2600
2601                 new_register_dissector(
2602                                 "atn-ulcs",
2603                                 dissect_atn_ulcs,
2604                                 proto_atn_ulcs);
2605
2606                 atn_cm_handle = find_dissector("atn-cm");
2607                 atn_cpdlc_handle = find_dissector("atn-cpdlc");
2608
2609                 /* initiate sub dissector list */
2610                 register_heur_dissector_list(
2611                                 "atn-ulcs",
2612                                 &atn_ulcs_heur_subdissector_list);
2613
2614                 /* init aare/aare data */
2615                 aarq_data_tree = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
2616
2617                 atn_conversation_tree = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
2618 }
2619
2620 void proto_reg_handoff_atn_ulcs(void)
2621 {
2622                 /* add session dissector to cotp dissector list dissector list*/
2623                 heur_dissector_add(
2624                                 "cotp",
2625                                 dissect_atn_ulcs_heur,
2626                                 proto_atn_ulcs);
2627 }
2628
2629 /*
2630  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
2631  *
2632  * Local variables:
2633  * c-basic-offset: 2
2634  * tab-width: 2
2635  * indent-tabs-mode: t
2636  * End:
2637  *
2638  * vi: set shiftwidth=2 tabstop=2 noexpandtab:
2639  * :indentSize=2:tabSize=2:noTabs=false:
2640  */