Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-atn-cm.c
blobc0282999eba14aa980ecd040b46d5c42e14bcd94
1 /* Do not modify this file. Changes will be overwritten. */
2 /* Generated automatically by the ASN.1 to Wireshark dissector compiler */
3 /* packet-atn-cm.c */
4 /* asn2wrs.py -u -q -L -p atn-cm -c ./atn-cm.cnf -s ./packet-atn-cm-template -D . -O ../.. atn-cm.asn */
6 /* packet-atn-cm.c
7 * By Mathias Guettler <guettler@web.de>
8 * Copyright 2013
10 * Routines for ATN context management protocol packet disassembly.
11 * ATN context management allows an aircraft
12 * to log on to a ground facility.
14 * details see:
15 * https://en.wikipedia.org/wiki/CPDLC
16 * https://members.optusnet.com.au/~cjr/introduction.htm
18 * standards:
19 * We are dealing with ATN/CPDLC aka ICAO Doc 9705 Second Edition here
20 * (CPDLC may also be transmitted via ACARS/AOA aka "FANS-1/A ").
21 * https://www.icao.int/safety/acp/repository/_%20Doc9705_ed2_1999.pdf
23 * Wireshark - Network traffic analyzer
24 * By Gerald Combs <gerald@wireshark.org>
25 * Copyright 1998 Gerald Combs
27 * SPDX-License-Identifier: GPL-2.0-or-later
30 #include "config.h"
32 #include <epan/packet.h>
33 #include <epan/exceptions.h>
34 #include <epan/conversation.h>
35 #include <wsutil/array.h>
36 #include "packet-ber.h"
37 #include "packet-per.h"
38 #include "packet-atn-ulcs.h"
40 #define ATN_CM_PROTO "ICAO Doc9705 CM"
42 void proto_register_atn_cm(void);
43 void proto_reg_handoff_atn_cm(void);
45 static int hf_atn_cm_CMAircraftMessage_PDU; /* CMAircraftMessage */
46 static int hf_atn_cm_CMGroundMessage_PDU; /* CMGroundMessage */
47 static int hf_atn_cm_cmLogonRequest; /* CMLogonRequest */
48 static int hf_atn_cm_cmContactResponse; /* CMContactResponse */
49 static int hf_atn_cm_cmAbortReason; /* CMAbortReason */
50 static int hf_atn_cm_cmLogonResponse; /* CMLogonResponse */
51 static int hf_atn_cm_cmUpdate; /* CMUpdate */
52 static int hf_atn_cm_cmContactRequest; /* CMContactRequest */
53 static int hf_atn_cm_cmForwardRequest; /* CMForwardRequest */
54 static int hf_atn_cm_cmForwardResponse; /* CMForwardResponse */
55 static int hf_atn_cm_longTsap; /* LongTsap */
56 static int hf_atn_cm_shortTsap; /* ShortTsap */
57 static int hf_atn_cm_aeQualifier; /* AEQualifier */
58 static int hf_atn_cm_apVersion; /* VersionNumber */
59 static int hf_atn_cm_apAddress; /* APAddress */
60 static int hf_atn_cm_facilityDesignation; /* FacilityDesignation */
61 static int hf_atn_cm_address; /* LongTsap */
62 static int hf_atn_cm_aircraftFlightIdentification; /* AircraftFlightIdentification */
63 static int hf_atn_cm_cMLongTSAP; /* LongTsap */
64 static int hf_atn_cm_groundInitiatedApplications; /* SEQUENCE_SIZE_1_256_OF_AEQualifierVersionAddress */
65 static int hf_atn_cm_groundInitiatedApplications_item; /* AEQualifierVersionAddress */
66 static int hf_atn_cm_airOnlyInitiatedApplications; /* SEQUENCE_SIZE_1_256_OF_AEQualifierVersion */
67 static int hf_atn_cm_airOnlyInitiatedApplications_item; /* AEQualifierVersion */
68 static int hf_atn_cm_airportDeparture; /* Airport */
69 static int hf_atn_cm_airportDestination; /* Airport */
70 static int hf_atn_cm_dateTimeDepartureETD; /* DateTime */
71 static int hf_atn_cm_airInitiatedApplications; /* SEQUENCE_SIZE_1_256_OF_AEQualifierVersionAddress */
72 static int hf_atn_cm_airInitiatedApplications_item; /* AEQualifierVersionAddress */
73 static int hf_atn_cm_groundOnlyInitiatedApplications; /* SEQUENCE_SIZE_1_256_OF_AEQualifierVersion */
74 static int hf_atn_cm_groundOnlyInitiatedApplications_item; /* AEQualifierVersion */
75 static int hf_atn_cm_year; /* Year */
76 static int hf_atn_cm_month; /* Month */
77 static int hf_atn_cm_day; /* Day */
78 static int hf_atn_cm_date; /* Date */
79 static int hf_atn_cm_time; /* Time */
80 static int hf_atn_cm_rDP; /* OCTET_STRING_SIZE_5 */
81 static int hf_atn_cm_aRS; /* OCTET_STRING_SIZE_3 */
82 static int hf_atn_cm_locSysNselTsel; /* OCTET_STRING_SIZE_10_11 */
83 static int hf_atn_cm_hours; /* Timehours */
84 static int hf_atn_cm_minutes; /* Timeminutes */
86 static int ett_atn_cm_CMAircraftMessage;
87 static int ett_atn_cm_CMGroundMessage;
88 static int ett_atn_cm_APAddress;
89 static int ett_atn_cm_AEQualifierVersion;
90 static int ett_atn_cm_AEQualifierVersionAddress;
91 static int ett_atn_cm_CMContactRequest;
92 static int ett_atn_cm_CMLogonRequest;
93 static int ett_atn_cm_SEQUENCE_SIZE_1_256_OF_AEQualifierVersionAddress;
94 static int ett_atn_cm_SEQUENCE_SIZE_1_256_OF_AEQualifierVersion;
95 static int ett_atn_cm_CMLogonResponse;
96 static int ett_atn_cm_Date;
97 static int ett_atn_cm_DateTime;
98 static int ett_atn_cm_LongTsap;
99 static int ett_atn_cm_ShortTsap;
100 static int ett_atn_cm_Time;
101 static int ett_atn_cm;
105 static int
106 dissect_atn_cm_AircraftFlightIdentification(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
107 offset = dissect_per_IA5String(tvb, offset, actx, tree, hf_index,
108 2, 8, false,
109 NULL);
111 return offset;
116 static int
117 dissect_atn_cm_OCTET_STRING_SIZE_5(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
118 offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
119 5, 5, false, NULL);
121 return offset;
126 static int
127 dissect_atn_cm_OCTET_STRING_SIZE_3(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
128 offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
129 3, 3, false, NULL);
131 return offset;
136 static int
137 dissect_atn_cm_OCTET_STRING_SIZE_10_11(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
138 offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
139 10, 11, false, NULL);
141 return offset;
145 static const per_sequence_t ShortTsap_sequence[] = {
146 { &hf_atn_cm_aRS , ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_atn_cm_OCTET_STRING_SIZE_3 },
147 { &hf_atn_cm_locSysNselTsel, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_atn_cm_OCTET_STRING_SIZE_10_11 },
148 { NULL, 0, 0, NULL }
151 static int
152 dissect_atn_cm_ShortTsap(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
153 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
154 ett_atn_cm_ShortTsap, ShortTsap_sequence);
156 return offset;
160 static const per_sequence_t LongTsap_sequence[] = {
161 { &hf_atn_cm_rDP , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_atn_cm_OCTET_STRING_SIZE_5 },
162 { &hf_atn_cm_shortTsap , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_atn_cm_ShortTsap },
163 { NULL, 0, 0, NULL }
166 static int
167 dissect_atn_cm_LongTsap(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
168 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
169 ett_atn_cm_LongTsap, LongTsap_sequence);
171 return offset;
176 static int
177 dissect_atn_cm_AEQualifier(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
178 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
179 0U, 255U, NULL, false);
181 return offset;
186 static int
187 dissect_atn_cm_VersionNumber(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
188 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
189 1U, 255U, NULL, false);
191 return offset;
195 static const value_string atn_cm_APAddress_vals[] = {
196 { 0, "longTsap" },
197 { 1, "shortTsap" },
198 { 0, NULL }
201 static const per_choice_t APAddress_choice[] = {
202 { 0, &hf_atn_cm_longTsap , ASN1_NO_EXTENSIONS , dissect_atn_cm_LongTsap },
203 { 1, &hf_atn_cm_shortTsap , ASN1_NO_EXTENSIONS , dissect_atn_cm_ShortTsap },
204 { 0, NULL, 0, NULL }
207 static int
208 dissect_atn_cm_APAddress(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
209 offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
210 ett_atn_cm_APAddress, APAddress_choice,
211 NULL);
213 return offset;
217 static const per_sequence_t AEQualifierVersionAddress_sequence[] = {
218 { &hf_atn_cm_aeQualifier , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_atn_cm_AEQualifier },
219 { &hf_atn_cm_apVersion , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_atn_cm_VersionNumber },
220 { &hf_atn_cm_apAddress , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_atn_cm_APAddress },
221 { NULL, 0, 0, NULL }
224 static int
225 dissect_atn_cm_AEQualifierVersionAddress(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
226 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
227 ett_atn_cm_AEQualifierVersionAddress, AEQualifierVersionAddress_sequence);
229 return offset;
233 static const per_sequence_t SEQUENCE_SIZE_1_256_OF_AEQualifierVersionAddress_sequence_of[1] = {
234 { &hf_atn_cm_groundInitiatedApplications_item, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_atn_cm_AEQualifierVersionAddress },
237 static int
238 dissect_atn_cm_SEQUENCE_SIZE_1_256_OF_AEQualifierVersionAddress(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
239 offset = dissect_per_constrained_sequence_of(tvb, offset, actx, tree, hf_index,
240 ett_atn_cm_SEQUENCE_SIZE_1_256_OF_AEQualifierVersionAddress, SEQUENCE_SIZE_1_256_OF_AEQualifierVersionAddress_sequence_of,
241 1, 256, false);
243 return offset;
247 static const per_sequence_t AEQualifierVersion_sequence[] = {
248 { &hf_atn_cm_aeQualifier , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_atn_cm_AEQualifier },
249 { &hf_atn_cm_apVersion , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_atn_cm_VersionNumber },
250 { NULL, 0, 0, NULL }
253 static int
254 dissect_atn_cm_AEQualifierVersion(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
255 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
256 ett_atn_cm_AEQualifierVersion, AEQualifierVersion_sequence);
258 return offset;
262 static const per_sequence_t SEQUENCE_SIZE_1_256_OF_AEQualifierVersion_sequence_of[1] = {
263 { &hf_atn_cm_airOnlyInitiatedApplications_item, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_atn_cm_AEQualifierVersion },
266 static int
267 dissect_atn_cm_SEQUENCE_SIZE_1_256_OF_AEQualifierVersion(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
268 offset = dissect_per_constrained_sequence_of(tvb, offset, actx, tree, hf_index,
269 ett_atn_cm_SEQUENCE_SIZE_1_256_OF_AEQualifierVersion, SEQUENCE_SIZE_1_256_OF_AEQualifierVersion_sequence_of,
270 1, 256, false);
272 return offset;
277 static int
278 dissect_atn_cm_FacilityDesignation(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
279 offset = dissect_per_IA5String(tvb, offset, actx, tree, hf_index,
280 4, 8, false,
281 NULL);
283 return offset;
288 static int
289 dissect_atn_cm_Airport(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
290 offset = dissect_per_IA5String(tvb, offset, actx, tree, hf_index,
291 4, 4, false,
292 NULL);
294 return offset;
299 static int
300 dissect_atn_cm_Year(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
301 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
302 1996U, 2095U, NULL, false);
304 return offset;
309 static int
310 dissect_atn_cm_Month(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
311 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
312 1U, 12U, NULL, false);
314 return offset;
319 static int
320 dissect_atn_cm_Day(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
321 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
322 1U, 31U, NULL, false);
324 return offset;
328 static const per_sequence_t Date_sequence[] = {
329 { &hf_atn_cm_year , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_atn_cm_Year },
330 { &hf_atn_cm_month , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_atn_cm_Month },
331 { &hf_atn_cm_day , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_atn_cm_Day },
332 { NULL, 0, 0, NULL }
335 static int
336 dissect_atn_cm_Date(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
337 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
338 ett_atn_cm_Date, Date_sequence);
340 return offset;
345 static int
346 dissect_atn_cm_Timehours(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
347 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
348 0U, 23U, NULL, false);
350 return offset;
355 static int
356 dissect_atn_cm_Timeminutes(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
357 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
358 0U, 59U, NULL, false);
360 return offset;
364 static const per_sequence_t Time_sequence[] = {
365 { &hf_atn_cm_hours , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_atn_cm_Timehours },
366 { &hf_atn_cm_minutes , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_atn_cm_Timeminutes },
367 { NULL, 0, 0, NULL }
370 static int
371 dissect_atn_cm_Time(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
372 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
373 ett_atn_cm_Time, Time_sequence);
375 return offset;
379 static const per_sequence_t DateTime_sequence[] = {
380 { &hf_atn_cm_date , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_atn_cm_Date },
381 { &hf_atn_cm_time , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_atn_cm_Time },
382 { NULL, 0, 0, NULL }
385 static int
386 dissect_atn_cm_DateTime(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
387 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
388 ett_atn_cm_DateTime, DateTime_sequence);
390 return offset;
394 static const per_sequence_t CMLogonRequest_sequence[] = {
395 { &hf_atn_cm_aircraftFlightIdentification, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_atn_cm_AircraftFlightIdentification },
396 { &hf_atn_cm_cMLongTSAP , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_atn_cm_LongTsap },
397 { &hf_atn_cm_groundInitiatedApplications, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_atn_cm_SEQUENCE_SIZE_1_256_OF_AEQualifierVersionAddress },
398 { &hf_atn_cm_airOnlyInitiatedApplications, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_atn_cm_SEQUENCE_SIZE_1_256_OF_AEQualifierVersion },
399 { &hf_atn_cm_facilityDesignation, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_atn_cm_FacilityDesignation },
400 { &hf_atn_cm_airportDeparture, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_atn_cm_Airport },
401 { &hf_atn_cm_airportDestination, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_atn_cm_Airport },
402 { &hf_atn_cm_dateTimeDepartureETD, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_atn_cm_DateTime },
403 { NULL, 0, 0, NULL }
406 static int
407 dissect_atn_cm_CMLogonRequest(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
408 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
409 ett_atn_cm_CMLogonRequest, CMLogonRequest_sequence);
411 return offset;
415 static const value_string atn_cm_Response_vals[] = {
416 { 0, "contactSuccess" },
417 { 1, "contactNotSuccessful" },
418 { 0, NULL }
422 static int
423 dissect_atn_cm_Response(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
424 offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
425 2, NULL, false, 0, NULL);
427 return offset;
432 static int
433 dissect_atn_cm_CMContactResponse(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
434 offset = dissect_atn_cm_Response(tvb, offset, actx, tree, hf_index);
436 return offset;
440 static const value_string atn_cm_CMAbortReason_vals[] = {
441 { 0, "timer-expired" },
442 { 1, "undefined-error" },
443 { 2, "invalid-PDU" },
444 { 3, "protocol-error" },
445 { 4, "dialogue-acceptance-not-permitted" },
446 { 5, "dialogue-end-not-accepted" },
447 { 6, "communication-service-error" },
448 { 7, "communication-service-failure" },
449 { 8, "invalid-QOS-parameter" },
450 { 9, "expected-PDU-missing" },
451 { 0, NULL }
455 static int
456 dissect_atn_cm_CMAbortReason(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
457 offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
458 10, NULL, true, 0, NULL);
460 return offset;
464 static const value_string atn_cm_CMAircraftMessage_vals[] = {
465 { 0, "cmLogonRequest" },
466 { 1, "cmContactResponse" },
467 { 2, "cmAbortReason" },
468 { 0, NULL }
471 static const per_choice_t CMAircraftMessage_choice[] = {
472 { 0, &hf_atn_cm_cmLogonRequest, ASN1_EXTENSION_ROOT , dissect_atn_cm_CMLogonRequest },
473 { 1, &hf_atn_cm_cmContactResponse, ASN1_EXTENSION_ROOT , dissect_atn_cm_CMContactResponse },
474 { 2, &hf_atn_cm_cmAbortReason, ASN1_EXTENSION_ROOT , dissect_atn_cm_CMAbortReason },
475 { 0, NULL, 0, NULL }
478 static int
479 dissect_atn_cm_CMAircraftMessage(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
480 offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
481 ett_atn_cm_CMAircraftMessage, CMAircraftMessage_choice,
482 NULL);
484 return offset;
488 static const per_sequence_t CMLogonResponse_sequence[] = {
489 { &hf_atn_cm_airInitiatedApplications, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_atn_cm_SEQUENCE_SIZE_1_256_OF_AEQualifierVersionAddress },
490 { &hf_atn_cm_groundOnlyInitiatedApplications, ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_atn_cm_SEQUENCE_SIZE_1_256_OF_AEQualifierVersion },
491 { NULL, 0, 0, NULL }
494 static int
495 dissect_atn_cm_CMLogonResponse(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
496 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
497 ett_atn_cm_CMLogonResponse, CMLogonResponse_sequence);
499 return offset;
504 static int
505 dissect_atn_cm_CMUpdate(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
506 offset = dissect_atn_cm_CMLogonResponse(tvb, offset, actx, tree, hf_index);
508 return offset;
512 static const per_sequence_t CMContactRequest_sequence[] = {
513 { &hf_atn_cm_facilityDesignation, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_atn_cm_FacilityDesignation },
514 { &hf_atn_cm_address , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_atn_cm_LongTsap },
515 { NULL, 0, 0, NULL }
518 static int
519 dissect_atn_cm_CMContactRequest(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
520 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
521 ett_atn_cm_CMContactRequest, CMContactRequest_sequence);
523 return offset;
528 static int
529 dissect_atn_cm_CMForwardRequest(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
530 offset = dissect_atn_cm_CMLogonRequest(tvb, offset, actx, tree, hf_index);
532 return offset;
536 static const value_string atn_cm_CMForwardResponse_vals[] = {
537 { 0, "success" },
538 { 1, "incompatible-version" },
539 { 2, "service-not-supported" },
540 { 0, NULL }
544 static int
545 dissect_atn_cm_CMForwardResponse(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
546 offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
547 3, NULL, false, 0, NULL);
549 return offset;
553 static const value_string atn_cm_CMGroundMessage_vals[] = {
554 { 0, "cmLogonResponse" },
555 { 1, "cmUpdate" },
556 { 2, "cmContactRequest" },
557 { 3, "cmForwardRequest" },
558 { 4, "cmAbortReason" },
559 { 5, "cmForwardResponse" },
560 { 0, NULL }
563 static const per_choice_t CMGroundMessage_choice[] = {
564 { 0, &hf_atn_cm_cmLogonResponse, ASN1_EXTENSION_ROOT , dissect_atn_cm_CMLogonResponse },
565 { 1, &hf_atn_cm_cmUpdate , ASN1_EXTENSION_ROOT , dissect_atn_cm_CMUpdate },
566 { 2, &hf_atn_cm_cmContactRequest, ASN1_EXTENSION_ROOT , dissect_atn_cm_CMContactRequest },
567 { 3, &hf_atn_cm_cmForwardRequest, ASN1_EXTENSION_ROOT , dissect_atn_cm_CMForwardRequest },
568 { 4, &hf_atn_cm_cmAbortReason, ASN1_EXTENSION_ROOT , dissect_atn_cm_CMAbortReason },
569 { 5, &hf_atn_cm_cmForwardResponse, ASN1_EXTENSION_ROOT , dissect_atn_cm_CMForwardResponse },
570 { 0, NULL, 0, NULL }
573 static int
574 dissect_atn_cm_CMGroundMessage(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
575 offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
576 ett_atn_cm_CMGroundMessage, CMGroundMessage_choice,
577 NULL);
579 return offset;
582 /*--- PDUs ---*/
584 static int dissect_CMAircraftMessage_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
585 int offset = 0;
586 asn1_ctx_t asn1_ctx;
587 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, false, pinfo);
588 offset = dissect_atn_cm_CMAircraftMessage(tvb, offset, &asn1_ctx, tree, hf_atn_cm_CMAircraftMessage_PDU);
589 offset += 7; offset >>= 3;
590 return offset;
592 static int dissect_CMGroundMessage_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
593 int offset = 0;
594 asn1_ctx_t asn1_ctx;
595 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, false, pinfo);
596 offset = dissect_atn_cm_CMGroundMessage(tvb, offset, &asn1_ctx, tree, hf_atn_cm_CMGroundMessage_PDU);
597 offset += 7; offset >>= 3;
598 return offset;
601 static int proto_atn_cm;
603 static int
604 dissect_atn_cm(
605 tvbuff_t *tvb,
606 packet_info *pinfo,
607 proto_tree *tree,
608 void *data _U_)
610 int type;
611 proto_tree *sub_tree;
613 sub_tree = proto_tree_add_subtree(
614 tree, tvb, 0, -1, ett_atn_cm, NULL, ATN_CM_PROTO);
616 /* ti = proto_tree_add_item(tree, proto_atn_cm, tvb, 0, 0 , ENC_NA); */
617 /* sub_tree = proto_item_add_subtree(ti, ett_atn_cm_pdu); */
619 /* determine whether it is uplink or downlink */
620 type = check_heur_msg_type(pinfo);
622 switch(type){
623 case um:
624 dissect_CMGroundMessage_PDU(
625 tvb,
626 pinfo,
627 sub_tree, NULL);
628 break;
629 case dm:
630 dissect_CMAircraftMessage_PDU(
631 tvb,
632 pinfo,
633 sub_tree, NULL);
634 break;
635 default:
636 break;
638 return tvb_reported_length_remaining(tvb, 0);
641 static bool
642 dissect_atn_cm_heur(
643 tvbuff_t *tvb,
644 packet_info *pinfo,
645 proto_tree *tree,
646 void *data _U_)
648 atn_conversation_t *volatile atn_cv = NULL;
649 volatile bool is_atn_cm = false;
650 int type;
652 /* determine whether it is uplink or downlink */
653 type = check_heur_msg_type(pinfo);
655 /* heuristically decode message */
656 switch(type){
657 case um:
658 TRY {
659 dissect_CMGroundMessage_PDU(
660 tvb,
661 pinfo,
662 NULL, NULL);
663 /* no exception thrown: looks like it is a CM PDU */
664 is_atn_cm = true; }
665 CATCH_ALL {
666 is_atn_cm = false; }
667 ENDTRY;
668 break;
669 case dm:
670 TRY {
671 dissect_CMAircraftMessage_PDU(
672 tvb,
673 pinfo,
674 NULL, NULL);
675 /* no exception thrown: looks like it is a CM PDU */
676 is_atn_cm = true;}
677 CATCH_ALL {
678 is_atn_cm = false; }
679 ENDTRY;
680 break;
681 default:
682 break;
685 if (is_atn_cm == true) {
686 /* note: */
687 /* all subsequent PDU's belonging to this conversation are considered CM */
688 /* if the first CM PDU has been decoded successfully */
689 /* (This is done in "atn-ulcs" by using "call_dissector_with_data()") */
691 /* DT: dstref present, srcref is always zero */
692 if((pinfo->clnp_dstref) &&
693 (!pinfo->clnp_srcref)){
695 atn_cv = find_atn_conversation(
696 &pinfo->dst,
697 pinfo->clnp_dstref,
698 &pinfo->src );
700 /* CR: srcref present, dstref is always zero */
701 if((!pinfo->clnp_dstref) &&
702 (pinfo->clnp_srcref)){
704 atn_cv = find_atn_conversation(
705 &pinfo->src,
706 pinfo->clnp_srcref,
707 &pinfo->dst );
710 /* CC: srcref and dstref present */
711 if((pinfo->clnp_dstref) &&
712 (pinfo->clnp_srcref)){
713 atn_cv = find_atn_conversation(
714 &pinfo->src,
715 pinfo->clnp_srcref,
716 &pinfo->dst );
718 if(atn_cv){
719 atn_cv->ae_qualifier = cma;
721 dissect_atn_cm(
722 tvb,
723 pinfo,
724 tree,
725 NULL);
728 return is_atn_cm;
732 void proto_register_atn_cm (void)
734 static hf_register_info hf_atn_cm[] = {
735 { &hf_atn_cm_CMAircraftMessage_PDU,
736 { "CMAircraftMessage", "atn-cm.CMAircraftMessage",
737 FT_UINT32, BASE_DEC, VALS(atn_cm_CMAircraftMessage_vals), 0,
738 NULL, HFILL }},
739 { &hf_atn_cm_CMGroundMessage_PDU,
740 { "CMGroundMessage", "atn-cm.CMGroundMessage",
741 FT_UINT32, BASE_DEC, VALS(atn_cm_CMGroundMessage_vals), 0,
742 NULL, HFILL }},
743 { &hf_atn_cm_cmLogonRequest,
744 { "cmLogonRequest", "atn-cm.cmLogonRequest_element",
745 FT_NONE, BASE_NONE, NULL, 0,
746 NULL, HFILL }},
747 { &hf_atn_cm_cmContactResponse,
748 { "cmContactResponse", "atn-cm.cmContactResponse",
749 FT_UINT32, BASE_DEC, VALS(atn_cm_Response_vals), 0,
750 NULL, HFILL }},
751 { &hf_atn_cm_cmAbortReason,
752 { "cmAbortReason", "atn-cm.cmAbortReason",
753 FT_UINT32, BASE_DEC, VALS(atn_cm_CMAbortReason_vals), 0,
754 NULL, HFILL }},
755 { &hf_atn_cm_cmLogonResponse,
756 { "cmLogonResponse", "atn-cm.cmLogonResponse_element",
757 FT_NONE, BASE_NONE, NULL, 0,
758 NULL, HFILL }},
759 { &hf_atn_cm_cmUpdate,
760 { "cmUpdate", "atn-cm.cmUpdate_element",
761 FT_NONE, BASE_NONE, NULL, 0,
762 NULL, HFILL }},
763 { &hf_atn_cm_cmContactRequest,
764 { "cmContactRequest", "atn-cm.cmContactRequest_element",
765 FT_NONE, BASE_NONE, NULL, 0,
766 NULL, HFILL }},
767 { &hf_atn_cm_cmForwardRequest,
768 { "cmForwardRequest", "atn-cm.cmForwardRequest_element",
769 FT_NONE, BASE_NONE, NULL, 0,
770 NULL, HFILL }},
771 { &hf_atn_cm_cmForwardResponse,
772 { "cmForwardResponse", "atn-cm.cmForwardResponse",
773 FT_UINT32, BASE_DEC, VALS(atn_cm_CMForwardResponse_vals), 0,
774 NULL, HFILL }},
775 { &hf_atn_cm_longTsap,
776 { "longTsap", "atn-cm.longTsap_element",
777 FT_NONE, BASE_NONE, NULL, 0,
778 NULL, HFILL }},
779 { &hf_atn_cm_shortTsap,
780 { "shortTsap", "atn-cm.shortTsap_element",
781 FT_NONE, BASE_NONE, NULL, 0,
782 NULL, HFILL }},
783 { &hf_atn_cm_aeQualifier,
784 { "aeQualifier", "atn-cm.aeQualifier",
785 FT_UINT32, BASE_DEC, NULL, 0,
786 NULL, HFILL }},
787 { &hf_atn_cm_apVersion,
788 { "apVersion", "atn-cm.apVersion",
789 FT_UINT32, BASE_DEC, NULL, 0,
790 "VersionNumber", HFILL }},
791 { &hf_atn_cm_apAddress,
792 { "apAddress", "atn-cm.apAddress",
793 FT_UINT32, BASE_DEC, VALS(atn_cm_APAddress_vals), 0,
794 NULL, HFILL }},
795 { &hf_atn_cm_facilityDesignation,
796 { "facilityDesignation", "atn-cm.facilityDesignation",
797 FT_STRING, BASE_NONE, NULL, 0,
798 NULL, HFILL }},
799 { &hf_atn_cm_address,
800 { "address", "atn-cm.address_element",
801 FT_NONE, BASE_NONE, NULL, 0,
802 "LongTsap", HFILL }},
803 { &hf_atn_cm_aircraftFlightIdentification,
804 { "aircraftFlightIdentification", "atn-cm.aircraftFlightIdentification",
805 FT_STRING, BASE_NONE, NULL, 0,
806 NULL, HFILL }},
807 { &hf_atn_cm_cMLongTSAP,
808 { "cMLongTSAP", "atn-cm.cMLongTSAP_element",
809 FT_NONE, BASE_NONE, NULL, 0,
810 "LongTsap", HFILL }},
811 { &hf_atn_cm_groundInitiatedApplications,
812 { "groundInitiatedApplications", "atn-cm.groundInitiatedApplications",
813 FT_UINT32, BASE_DEC, NULL, 0,
814 "SEQUENCE_SIZE_1_256_OF_AEQualifierVersionAddress", HFILL }},
815 { &hf_atn_cm_groundInitiatedApplications_item,
816 { "AEQualifierVersionAddress", "atn-cm.AEQualifierVersionAddress_element",
817 FT_NONE, BASE_NONE, NULL, 0,
818 NULL, HFILL }},
819 { &hf_atn_cm_airOnlyInitiatedApplications,
820 { "airOnlyInitiatedApplications", "atn-cm.airOnlyInitiatedApplications",
821 FT_UINT32, BASE_DEC, NULL, 0,
822 "SEQUENCE_SIZE_1_256_OF_AEQualifierVersion", HFILL }},
823 { &hf_atn_cm_airOnlyInitiatedApplications_item,
824 { "AEQualifierVersion", "atn-cm.AEQualifierVersion_element",
825 FT_NONE, BASE_NONE, NULL, 0,
826 NULL, HFILL }},
827 { &hf_atn_cm_airportDeparture,
828 { "airportDeparture", "atn-cm.airportDeparture",
829 FT_STRING, BASE_NONE, NULL, 0,
830 "Airport", HFILL }},
831 { &hf_atn_cm_airportDestination,
832 { "airportDestination", "atn-cm.airportDestination",
833 FT_STRING, BASE_NONE, NULL, 0,
834 "Airport", HFILL }},
835 { &hf_atn_cm_dateTimeDepartureETD,
836 { "dateTimeDepartureETD", "atn-cm.dateTimeDepartureETD_element",
837 FT_NONE, BASE_NONE, NULL, 0,
838 "DateTime", HFILL }},
839 { &hf_atn_cm_airInitiatedApplications,
840 { "airInitiatedApplications", "atn-cm.airInitiatedApplications",
841 FT_UINT32, BASE_DEC, NULL, 0,
842 "SEQUENCE_SIZE_1_256_OF_AEQualifierVersionAddress", HFILL }},
843 { &hf_atn_cm_airInitiatedApplications_item,
844 { "AEQualifierVersionAddress", "atn-cm.AEQualifierVersionAddress_element",
845 FT_NONE, BASE_NONE, NULL, 0,
846 NULL, HFILL }},
847 { &hf_atn_cm_groundOnlyInitiatedApplications,
848 { "groundOnlyInitiatedApplications", "atn-cm.groundOnlyInitiatedApplications",
849 FT_UINT32, BASE_DEC, NULL, 0,
850 "SEQUENCE_SIZE_1_256_OF_AEQualifierVersion", HFILL }},
851 { &hf_atn_cm_groundOnlyInitiatedApplications_item,
852 { "AEQualifierVersion", "atn-cm.AEQualifierVersion_element",
853 FT_NONE, BASE_NONE, NULL, 0,
854 NULL, HFILL }},
855 { &hf_atn_cm_year,
856 { "year", "atn-cm.year",
857 FT_UINT32, BASE_DEC, NULL, 0,
858 NULL, HFILL }},
859 { &hf_atn_cm_month,
860 { "month", "atn-cm.month",
861 FT_UINT32, BASE_DEC, NULL, 0,
862 NULL, HFILL }},
863 { &hf_atn_cm_day,
864 { "day", "atn-cm.day",
865 FT_UINT32, BASE_DEC, NULL, 0,
866 NULL, HFILL }},
867 { &hf_atn_cm_date,
868 { "date", "atn-cm.date_element",
869 FT_NONE, BASE_NONE, NULL, 0,
870 NULL, HFILL }},
871 { &hf_atn_cm_time,
872 { "time", "atn-cm.time_element",
873 FT_NONE, BASE_NONE, NULL, 0,
874 NULL, HFILL }},
875 { &hf_atn_cm_rDP,
876 { "rDP", "atn-cm.rDP",
877 FT_BYTES, BASE_NONE, NULL, 0,
878 "OCTET_STRING_SIZE_5", HFILL }},
879 { &hf_atn_cm_aRS,
880 { "aRS", "atn-cm.aRS",
881 FT_BYTES, BASE_NONE, NULL, 0,
882 "OCTET_STRING_SIZE_3", HFILL }},
883 { &hf_atn_cm_locSysNselTsel,
884 { "locSysNselTsel", "atn-cm.locSysNselTsel",
885 FT_BYTES, BASE_NONE, NULL, 0,
886 "OCTET_STRING_SIZE_10_11", HFILL }},
887 { &hf_atn_cm_hours,
888 { "hours", "atn-cm.hours",
889 FT_UINT32, BASE_DEC, NULL, 0,
890 "Timehours", HFILL }},
891 { &hf_atn_cm_minutes,
892 { "minutes", "atn-cm.minutes",
893 FT_UINT32, BASE_DEC, NULL, 0,
894 "Timeminutes", HFILL }},
896 static int *ett[] = {
897 &ett_atn_cm_CMAircraftMessage,
898 &ett_atn_cm_CMGroundMessage,
899 &ett_atn_cm_APAddress,
900 &ett_atn_cm_AEQualifierVersion,
901 &ett_atn_cm_AEQualifierVersionAddress,
902 &ett_atn_cm_CMContactRequest,
903 &ett_atn_cm_CMLogonRequest,
904 &ett_atn_cm_SEQUENCE_SIZE_1_256_OF_AEQualifierVersionAddress,
905 &ett_atn_cm_SEQUENCE_SIZE_1_256_OF_AEQualifierVersion,
906 &ett_atn_cm_CMLogonResponse,
907 &ett_atn_cm_Date,
908 &ett_atn_cm_DateTime,
909 &ett_atn_cm_LongTsap,
910 &ett_atn_cm_ShortTsap,
911 &ett_atn_cm_Time,
912 &ett_atn_cm
915 /* register CM application */
916 proto_atn_cm = proto_register_protocol(ATN_CM_PROTO, "ATN-CM", "atn-cm");
918 proto_register_field_array(
919 proto_atn_cm,
920 hf_atn_cm,
921 array_length(hf_atn_cm));
923 proto_register_subtree_array(
924 ett,
925 array_length(ett));
927 register_dissector(
928 "atn-cm",
929 dissect_atn_cm,
930 proto_atn_cm);
933 void proto_reg_handoff_atn_cm(void)
935 /* add session dissector to subdissector list*/
936 heur_dissector_add(
937 "atn-ulcs",
938 dissect_atn_cm_heur,
939 "ATN-CM over ATN-ULCS",
940 "atn-cm-ulcs",
941 proto_atn_cm, HEURISTIC_ENABLE);
945 * Editor modelines - https://www.wireshark.org/tools/modelines.html
947 * Local variables:
948 * c-basic-offset: 4
949 * tab-width: 8
950 * indent-tabs-mode: nil
951 * End:
953 * vi: set shiftwidth=4 tabstop=8 expandtab:
954 * :indentSize=4:tabSize=8:noTabs=true: