aboutsummaryrefslogtreecommitdiffstats
path: root/asn1/atn-cm
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2013-08-08 05:09:13 +0000
committerAnders Broman <anders.broman@ericsson.com>2013-08-08 05:09:13 +0000
commita4d1560fd1557820d69f8c8e106e368c2357340c (patch)
treea8006d104cf51073c1d266f468e2159f8a747186 /asn1/atn-cm
parent6e0c354769120a73c6a0c65b97e7841d18db606c (diff)
From Mathias Guettler:
New dissector for Air/Ground Datalink ICAO doc 9705 Ed2: ULCS, CM, CPDLC. Just adding the files to SVN for now. svn path=/trunk/; revision=51210
Diffstat (limited to 'asn1/atn-cm')
-rw-r--r--asn1/atn-cm/Makefile.am12
-rw-r--r--asn1/atn-cm/Makefile.common28
-rw-r--r--asn1/atn-cm/Makefile.nmake6
-rw-r--r--asn1/atn-cm/atn-cm.asn199
-rw-r--r--asn1/atn-cm/atn-cm.cnf25
-rw-r--r--asn1/atn-cm/packet-atn-cm-template.c261
6 files changed, 531 insertions, 0 deletions
diff --git a/asn1/atn-cm/Makefile.am b/asn1/atn-cm/Makefile.am
new file mode 100644
index 0000000000..b252c3329f
--- /dev/null
+++ b/asn1/atn-cm/Makefile.am
@@ -0,0 +1,12 @@
+# Makefile.am
+# ASN.1-based plugin atn-cm
+# Contact Management (CM) version 1
+# ICAO doc doc9705 Ed. 2
+# Aereonautical Telecommunications Network (ATN)
+#
+# (c) 2013 Mathias Guettler guettler@web.de
+#
+include ../Makefile.preinc
+include Makefile.common
+include ../Makefile.inc
+
diff --git a/asn1/atn-cm/Makefile.common b/asn1/atn-cm/Makefile.common
new file mode 100644
index 0000000000..4f4af95c4e
--- /dev/null
+++ b/asn1/atn-cm/Makefile.common
@@ -0,0 +1,28 @@
+# ASN.1-based plugin atn-cm
+# Contact Management (CM) version 1
+# ICAO doc doc9705 Ed. 2
+# Aereonautical Telecommunications Network (ATN)
+#
+# (c) 2013 Mathias Guettler guettler@web.de
+#
+PROTOCOL_NAME = atn-cm
+
+EXT_ASN_FILE_LIST =
+
+ASN_FILE_LIST = $(PROTOCOL_NAME).asn
+
+EXTRA_DIST = \
+ Makefile.nmake \
+ $(ASN_FILE_LIST) \
+ packet-$(PROTOCOL_NAME)-template.c \
+ $(PROTOCOL_NAME).cnf
+
+SRC_FILES = \
+ $(EXTRA_DIST) \
+ $(EXT_ASN_FILE_LIST)
+
+# ASN1 PER unaligned encoding
+A2W_FLAGS= -u -L
+
+EXTRA_CNF=
+
diff --git a/asn1/atn-cm/Makefile.nmake b/asn1/atn-cm/Makefile.nmake
new file mode 100644
index 0000000000..78b3419d2b
--- /dev/null
+++ b/asn1/atn-cm/Makefile.nmake
@@ -0,0 +1,6 @@
+
+include ../../config.nmake
+include ../Makefile.preinc.nmake
+include Makefile.common
+include ../Makefile.inc.nmake
+
diff --git a/asn1/atn-cm/atn-cm.asn b/asn1/atn-cm/atn-cm.asn
new file mode 100644
index 0000000000..ccd9bbe198
--- /dev/null
+++ b/asn1/atn-cm/atn-cm.asn
@@ -0,0 +1,199 @@
+-- c-basic-offset: 2; tab-width: 2; indent-tabs-mode: t
+-- vi: set shiftwidth=2 tabstop=2 noexpandtab:
+-- :indentSize=2:tabSize=2:noTabs=false:
+
+
+-- ICAO doc 9705 Edition 2 Contact Management (CM)
+CMMessageSetVersion1 DEFINITIONS AUTOMATIC TAGS ::=
+BEGIN
+
+-- ----------------------------------------------------------------------------------
+-- CM Message Structure
+-- ----------------------------------------------------------------------------------
+-- Aircraft-generated messages
+
+CMAircraftMessage ::= CHOICE
+{
+ cmLogonRequest [0] CMLogonRequest,
+ cmContactResponse [1] CMContactResponse,
+ cmAbortReason [2] CMAbortReason,
+ ...
+}
+
+-- Ground-generated messages
+
+CMGroundMessage ::= CHOICE
+{
+ cmLogonResponse [0] CMLogonResponse,
+ cmUpdate [1] CMUpdate,
+ cmContactRequest [2] CMContactRequest,
+ cmForwardRequest [3] CMForwardRequest,
+ cmAbortReason [4] CMAbortReason,
+ cmForwardResponse [5] CMForwardResponse,
+ ...
+}
+
+-- ----------------------------------------------------------------------------------
+-- CM Message Components
+-- ----------------------------------------------------------------------------------
+
+AircraftFlightIdentification ::= IA5String(SIZE(2..8))
+Airport ::=IA5String (SIZE(4))
+
+APAddress ::= CHOICE
+{
+ longTsap [0] LongTsap,
+ shortTsap [1] ShortTsap
+}
+
+AEQualifier ::= INTEGER (0..255)
+-- ATN AE-Qualifier Numeric Values are described in 4
+
+AEQualifierVersion ::= SEQUENCE
+{
+ aeQualifier AEQualifier,
+ apVersion VersionNumber
+}
+
+AEQualifierVersionAddress ::= SEQUENCE
+{
+ aeQualifier AEQualifier,
+ apVersion VersionNumber,
+ apAddress APAddress
+}
+
+CMAbortReason ::= ENUMERATED
+{
+ timer-expired (0),
+ undefined-error (1),
+ invalid-PDU (2),
+ protocol-error (3),
+ dialogue-acceptance-not-permitted (4),
+ dialogue-end-not-accepted (5),
+ communication-service-error (6),
+ communication-service-failure (7),
+ invalid-QOS-parameter (8),
+ expected-PDU-missing (9),
+ ...
+}
+
+CMContactRequest ::= SEQUENCE
+{
+ facilityDesignation FacilityDesignation,
+ address LongTsap
+}
+
+CMContactResponse ::= Response
+
+
+CMForwardRequest ::= CMLogonRequest
+
+CMForwardResponse ::= ENUMERATED
+{
+ success (0),
+ incompatible-version (1),
+ service-not-supported (2)
+}
+
+CMLogonRequest ::= SEQUENCE
+{
+ aircraftFlightIdentification [0] AircraftFlightIdentification,
+ cMLongTSAP [1] LongTsap,
+
+ groundInitiatedApplications [2] SEQUENCE SIZE (1..256) OF AEQualifierVersionAddress OPTIONAL,
+ airOnlyInitiatedApplications [3] SEQUENCE SIZE (1..256) OF AEQualifierVersion OPTIONAL,
+ facilityDesignation [4] FacilityDesignation OPTIONAL,
+ airportDeparture [5] Airport OPTIONAL,
+ airportDestination [6] Airport OPTIONAL,
+ dateTimeDepartureETD [7] DateTime OPTIONAL
+}
+
+CMLogonResponse ::= SEQUENCE
+{
+ airInitiatedApplications [0] SEQUENCE SIZE (1..256) OF AEQualifierVersionAddress
+ OPTIONAL,
+ groundOnlyInitiatedApplications [1] SEQUENCE SIZE (1..256) OF AEQualifierVersion
+ OPTIONAL
+}
+
+CMUpdate ::= CMLogonResponse
+
+Date ::= SEQUENCE
+{
+ year Year,
+ month Month,
+ day Day
+}
+
+ -- The Date field does not have to correspond to the flight if the field is not to be used;
+ -- the field's value can be assigned a meaningless, but compliant, value locally. If operational
+ -- use of the Date field is intended, there must be bilateral agreements in place to ensure its proper
+ -- use. This is a local implementation issue.
+
+DateTime ::= SEQUENCE
+{
+ date Date,
+ time Time
+}
+
+Day ::= INTEGER (1..31)
+ --unit = Day, Range (1..31), resolution = 1
+
+FacilityDesignation ::= IA5String (SIZE(4..8))
+
+LongTsap ::= SEQUENCE
+{
+ rDP OCTET STRING (SIZE(5)),
+ shortTsap ShortTsap
+}
+
+Month ::= INTEGER (1..12)
+ --unit = Month, Range (1..12), resolution = 1
+
+Response ::= ENUMERATED
+{
+ contactSuccess (0),
+ contactNotSuccessful (1)
+}
+
+ShortTsap ::= SEQUENCE
+{
+ aRS [0] OCTET STRING (SIZE(3)) OPTIONAL,
+ -- the aRS contains the ICAO 24 bit aircraft address when the ShortTsap belongs to an aircraft;
+ -- or a ground address when the Short Tsap belongs to a ground system
+ locSysNselTsel [1] OCTET STRING (SIZE(10..11))
+}
+
+Time ::= SEQUENCE
+{
+ hours Timehours,
+ minutes Timeminutes
+}
+
+Timehours ::= INTEGER (0..23)
+-- units = hour, range (0..23), resolution = 1 hour
+
+Timeminutes ::= INTEGER (0..59)
+-- units = minute, range (0..59), resolution = 1 minute
+
+VersionNumber ::= INTEGER (1..255)
+ -- VersionNumber 0 is reserved for the Dialogue Service
+
+Year ::= INTEGER (1996..2095)
+ --unit = Year, Range (1996..2095), resolution = 1
+
+END
+
+--
+-- Editor modelines - http://www.wireshark.org/tools/modelines.html
+--
+-- Local variables:
+-- c-basic-offset: 2
+-- tab-width: 2
+-- indent-tabs-mode: t
+-- End:
+--
+-- vi: set shiftwidth=2 tabstop=2 noexpandtab:
+-- :indentSize=2:tabSize=2:noTabs=false:
+--
+
diff --git a/asn1/atn-cm/atn-cm.cnf b/asn1/atn-cm/atn-cm.cnf
new file mode 100644
index 0000000000..077fbef454
--- /dev/null
+++ b/asn1/atn-cm/atn-cm.cnf
@@ -0,0 +1,25 @@
+# c-basic-offset: 2; tab-width: 2; indent-tabs-mode: t
+# vi: set shiftwidth=2 tabstop=2 noexpandtab:
+# :indentSize=2:tabSize=2:noTabs=false:
+
+#.MODULE_IMPORT
+
+#.EXPORTS
+
+#.PDU
+ CMAircraftMessage
+ CMGroundMessage
+#.END
+
+#
+# Editor modelines - http://www.wireshark.org/tools/modelines.html
+#
+# Local variables:
+# c-basic-offset: 2
+# tab-width: 2
+# indent-tabs-mode: t
+# End:
+#
+# vi: set shiftwidth=2 tabstop=2 noexpandtab:
+# :indentSize=2:tabSize=2:noTabs=false:
+# \ No newline at end of file
diff --git a/asn1/atn-cm/packet-atn-cm-template.c b/asn1/atn-cm/packet-atn-cm-template.c
new file mode 100644
index 0000000000..6d6eed1fa6
--- /dev/null
+++ b/asn1/atn-cm/packet-atn-cm-template.c
@@ -0,0 +1,261 @@
+/* c-basic-offset: 2; tab-width: 2; indent-tabs-mode: t
+ * vi: set shiftwidth=2 tabstop=2 noexpandtab:
+ * :indentSize=2:tabSize=2:noTabs=false:
+ */
+
+/* packet-atn-cm.c
+ * By Mathias Guettler <guettler@web.de>
+ * Copyright 2013
+ *
+ * Routines for ATN context management protocol packet disassembly.
+ * ATN context management allows an aircraft
+ * to log on to a ground facility.
+
+ * details see:
+ * http://en.wikipedia.org/wiki/CPDLC
+ * http://members.optusnet.com.au/~cjr/introduction.htm
+
+ * standards:
+ * http://legacy.icao.int/anb/panels/acp/repository.cfm
+
+ * note:
+ * We are dealing with ATN/CPDLC aka ICAO Doc 9705 Ed2 here
+ * (CPDLC may also be transmitted via ACARS/AOA aka "FANS-1/A ").
+
+
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <glib.h>
+#include <epan/packet.h>
+#include <epan/conversation.h>
+#include <epan/dissectors/packet-ber.h>
+#include <epan/dissectors/packet-per.h>
+#include <epan/emem.h>
+#include <epan/conversation.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <stdint.h>
+
+#include "packet-atn-ulcs.h"
+
+#define ATN_CM_PROTO "ICAO Doc9705 CM"
+
+#include "packet-atn-cm-hf.c"
+
+#include "packet-atn-cm-ett.c"
+static gint ett_atn_cm = -1;
+
+#include "packet-atn-cm-fn.c"
+static int proto_atn_cm = -1;
+
+static int
+dissect_atn_cm(
+ tvbuff_t *tvb,
+ packet_info *pinfo,
+ proto_tree *tree,
+ void *data _U_)
+{
+ int type = no_msg;
+ proto_item *ti = NULL;
+ proto_tree *sub_tree = NULL;
+
+ ti = proto_tree_add_text(
+ tree,
+ tvb,
+ 0,
+ tvb_reported_length_remaining(tvb, 0) ,
+ ATN_CM_PROTO);
+
+ sub_tree = proto_item_add_subtree(
+ ti,
+ ett_atn_cm);
+
+ /* ti = proto_tree_add_item(tree, proto_atn_cm, tvb, 0, 0 , FALSE); */
+ /* sub_tree = proto_item_add_subtree(ti, ett_atn_cm_pdu); */
+
+ /* determine whether it is uplink or downlink */
+ type = check_heur_msg_type(pinfo);
+
+ switch(type){
+ case um:
+ dissect_CMGroundMessage_PDU(
+ tvb,
+ pinfo,
+ sub_tree);
+ break;
+ case dm:
+ dissect_CMAircraftMessage_PDU(
+ tvb,
+ pinfo,
+ sub_tree);
+ break;
+ default:
+ break;
+ }
+ return tvb_reported_length_remaining(tvb, 0);
+}
+
+static gboolean
+dissect_atn_cm_heur(
+ tvbuff_t *tvb,
+ packet_info *pinfo,
+ proto_tree *tree,
+ void *data _U_)
+{
+ atn_conversation_t *atn_cv = NULL;
+ gboolean is_atn_cm = FALSE;
+ int type;
+
+ /* determine whether it is uplink or downlink */
+ type = check_heur_msg_type(pinfo);
+
+ /* heuristically decode message */
+ switch(type){
+ case um:
+ TRY {
+ dissect_CMGroundMessage_PDU(
+ tvb,
+ pinfo,
+ NULL);
+ /* no exception thrown: looks like it is a CM PDU */
+ is_atn_cm = TRUE; }
+ CATCH_ALL {
+ is_atn_cm = FALSE; }
+ ENDTRY;
+ break;
+ case dm:
+ TRY {
+ dissect_CMAircraftMessage_PDU(
+ tvb,
+ pinfo,
+ NULL);
+ /* no exception thrown: looks like it is a CM PDU */
+ is_atn_cm = TRUE;}
+ CATCH_ALL {
+ is_atn_cm = FALSE; }
+ ENDTRY;
+ break;
+ default:
+ break;
+ }
+
+ if (is_atn_cm == TRUE) {
+ /* note: */
+ /* all subsequent PDU's belonging to this conversation are considered CM */
+ /* if the first CM PDU has been decoded succesfully */
+ /* (This is done in "atn-ulcs" by using "call_dissector_with_data()") */
+
+ /* DT: dstref present, srcref is always zero */
+ if((pinfo->clnp_dstref) &&
+ (!pinfo->clnp_srcref)){
+
+ atn_cv = find_atn_conversation(
+ &pinfo->dst,
+ pinfo->clnp_dstref,
+ &pinfo->src );
+ }
+ /* CR: srcref present, dstref is always zero */
+ if((!pinfo->clnp_dstref) &&
+ (pinfo->clnp_srcref)){
+
+ atn_cv = find_atn_conversation(
+ &pinfo->src,
+ pinfo->clnp_srcref,
+ &pinfo->dst );
+
+ }
+ /* CC: srcref and dstref present */
+ if((pinfo->clnp_dstref) &&
+ (pinfo->clnp_srcref)){
+ atn_cv = find_atn_conversation(
+ &pinfo->src,
+ pinfo->clnp_srcref,
+ &pinfo->dst );
+ }
+ if(atn_cv){
+ atn_cv->ae_qualifier = cma;
+ }
+ dissect_atn_cm(
+ tvb,
+ pinfo,
+ tree,
+ NULL);
+ }
+
+ return is_atn_cm;
+}
+
+
+void proto_register_atn_cm (void)
+{
+ static hf_register_info hf_atn_cm[] = {
+ #include "packet-atn-cm-hfarr.c"
+ };
+ static gint *ett[] = {
+ #include "packet-atn-cm-ettarr.c"
+ &ett_atn_cm
+ };
+
+ /* register CM application */
+ proto_atn_cm = proto_register_protocol(
+ ATN_CM_PROTO ,
+ "ATN-CM",
+ "atn-cm");
+
+ proto_register_field_array(
+ proto_atn_cm,
+ hf_atn_cm,
+ array_length(hf_atn_cm));
+
+ proto_register_subtree_array(
+ ett,
+ array_length(ett));
+
+ new_register_dissector(
+ "atn-cm",
+ dissect_atn_cm,
+ proto_atn_cm);
+}
+
+void proto_reg_handoff_atn_cm(void)
+{
+ /* add session dissector to subdissector list*/
+ heur_dissector_add(
+ "atn-ulcs",
+ dissect_atn_cm_heur,
+ proto_atn_cm);
+}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 2
+ * tab-width: 2
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=2 tabstop=2 noexpandtab:
+ * :indentSize=2:tabSize=2:noTabs=false:
+ */
+