2 * By Mathias Guettler <guettler@web.de>
5 * Routines for ATN context management protocol packet disassembly.
6 * ATN context management allows an aircraft
7 * to log on to a ground facility.
10 * https://en.wikipedia.org/wiki/CPDLC
11 * https://members.optusnet.com.au/~cjr/introduction.htm
14 * We are dealing with ATN/CPDLC aka ICAO Doc 9705 Second Edition here
15 * (CPDLC may also be transmitted via ACARS/AOA aka "FANS-1/A ").
16 * https://www.icao.int/safety/acp/repository/_%20Doc9705_ed2_1999.pdf
18 * Wireshark - Network traffic analyzer
19 * By Gerald Combs <gerald@wireshark.org>
20 * Copyright 1998 Gerald Combs
22 * SPDX-License-Identifier: GPL-2.0-or-later
27 #include <epan/packet.h>
28 #include <epan/exceptions.h>
29 #include <epan/conversation.h>
30 #include <wsutil/array.h>
31 #include "packet-ber.h"
32 #include "packet-per.h"
33 #include "packet-atn-ulcs.h"
35 #define ATN_CM_PROTO "ICAO Doc9705 CM"
37 void proto_register_atn_cm(void);
38 void proto_reg_handoff_atn_cm(void);
40 #include "packet-atn-cm-hf.c"
42 #include "packet-atn-cm-ett.c"
43 static int ett_atn_cm
;
45 #include "packet-atn-cm-fn.c"
46 static int proto_atn_cm
;
58 sub_tree
= proto_tree_add_subtree(
59 tree
, tvb
, 0, -1, ett_atn_cm
, NULL
, ATN_CM_PROTO
);
61 /* ti = proto_tree_add_item(tree, proto_atn_cm, tvb, 0, 0 , ENC_NA); */
62 /* sub_tree = proto_item_add_subtree(ti, ett_atn_cm_pdu); */
64 /* determine whether it is uplink or downlink */
65 type
= check_heur_msg_type(pinfo
);
69 dissect_CMGroundMessage_PDU(
75 dissect_CMAircraftMessage_PDU(
83 return tvb_reported_length_remaining(tvb
, 0);
93 atn_conversation_t
*volatile atn_cv
= NULL
;
94 volatile bool is_atn_cm
= false;
97 /* determine whether it is uplink or downlink */
98 type
= check_heur_msg_type(pinfo
);
100 /* heuristically decode message */
104 dissect_CMGroundMessage_PDU(
108 /* no exception thrown: looks like it is a CM PDU */
116 dissect_CMAircraftMessage_PDU(
120 /* no exception thrown: looks like it is a CM PDU */
130 if (is_atn_cm
== true) {
132 /* all subsequent PDU's belonging to this conversation are considered CM */
133 /* if the first CM PDU has been decoded successfully */
134 /* (This is done in "atn-ulcs" by using "call_dissector_with_data()") */
136 /* DT: dstref present, srcref is always zero */
137 if((pinfo
->clnp_dstref
) &&
138 (!pinfo
->clnp_srcref
)){
140 atn_cv
= find_atn_conversation(
145 /* CR: srcref present, dstref is always zero */
146 if((!pinfo
->clnp_dstref
) &&
147 (pinfo
->clnp_srcref
)){
149 atn_cv
= find_atn_conversation(
155 /* CC: srcref and dstref present */
156 if((pinfo
->clnp_dstref
) &&
157 (pinfo
->clnp_srcref
)){
158 atn_cv
= find_atn_conversation(
164 atn_cv
->ae_qualifier
= cma
;
177 void proto_register_atn_cm (void)
179 static hf_register_info hf_atn_cm
[] = {
180 #include "packet-atn-cm-hfarr.c"
182 static int *ett
[] = {
183 #include "packet-atn-cm-ettarr.c"
187 /* register CM application */
188 proto_atn_cm
= proto_register_protocol(ATN_CM_PROTO
, "ATN-CM", "atn-cm");
190 proto_register_field_array(
193 array_length(hf_atn_cm
));
195 proto_register_subtree_array(
205 void proto_reg_handoff_atn_cm(void)
207 /* add session dissector to subdissector list*/
211 "ATN-CM over ATN-ULCS",
213 proto_atn_cm
, HEURISTIC_ENABLE
);
217 * Editor modelines - https://www.wireshark.org/tools/modelines.html
222 * indent-tabs-mode: nil
225 * vi: set shiftwidth=4 tabstop=8 expandtab:
226 * :indentSize=4:tabSize=8:noTabs=true: