From e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 10 Apr 2024 22:34:10 +0200 Subject: Adding upstream version 4.2.2. Signed-off-by: Daniel Baumann --- epan/dissectors/packet-dmp.c | 4981 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 4981 insertions(+) create mode 100644 epan/dissectors/packet-dmp.c (limited to 'epan/dissectors/packet-dmp.c') diff --git a/epan/dissectors/packet-dmp.c b/epan/dissectors/packet-dmp.c new file mode 100644 index 0000000..6029d30 --- /dev/null +++ b/epan/dissectors/packet-dmp.c @@ -0,0 +1,4981 @@ +/* packet-dmp.c + * + * Routines for STANAG 4406 Direct Message Profile packet disassembly. + * A protocol for optimised transfer of time-critical short messages + * for use with a reliable bearer service. Checksum and retransmission + * mechanisms are activated when using unreliable bearer services. + * + * Copyright 2006, Stig Bjorlykke , Thales Norway AS + * + * Wireshark - Network traffic analyzer + * By Gerald Combs + * Copyright 1998 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0-or-later + * + * Ref: http://jcs.dtic.mil/j6/cceb/acps/acp123/ + * https://web.archive.org/web/20100326015412/http://jcs.dtic.mil/j6/cceb/acps/acp123/ACP123A.pdf + */ + +/* + * TODO: + * - Dissect extended Restrictive security categories + * - Add Transmission/Retransmission statistics + */ + +#include "config.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "packet-p1.h" +#include "packet-p22.h" +#include "packet-s5066sis.h" + +void proto_register_dmp(void); +void proto_reg_handoff_dmp(void); + +#define PNAME "Direct Message Profile" +#define PSNAME "DMP" +#define PFNAME "dmp" + +/* Default UDP Port Number */ +#define DEFAULT_DMP_PORT_RANGE "5031" + +/* Protocol Identifier */ +#define PROT_NAT 0x0D +#define PROT_DMP 0x1D + +/* Versions supported */ +#define DMP_VERSION_1 1 +#define DMP_VERSION_2 2 + +/* Message Type (dmp.msg_type) */ +#define STANAG 0x0 +#define IPM 0x1 +#define REPORT 0x2 +#define NOTIF 0x3 +#define ACK 0x4 + +/* Message Identifier Type (dmp.msg_id_type) */ +#define ONLY_DMP_ID 0x0 +#define X400_MSG_ID 0x1 +#define NAT_MSG_ID 0x2 + +/* Report Type (dmp.report_type) */ +#define DR 0x0 +#define NDR 0x1 + +/* Notification Type (dmp.notif_type) */ +#define RN 0x0 +#define NRN 0x1 +#define ON 0x2 + +/* Address Encoding (dmp.addr_enc) */ +#define DIRECT_ADDR 0x0 +#define EXTENDED_ADDR 0x1 + +/* Address type (internal values) */ +#define ORIGINATOR 1 +#define P1_ADDRESS 2 +#define P2_ADDRESS 3 +#define ORIG_P2_ADDRESS 4 + +/* Extended Address Form (dmp_addr_form) */ +#define P1_DIRECT 0x0 +#define P2_DIRECT 0x1 +#define P1_EXTENDED 0x2 +#define P2_EXTENDED 0x3 +#define P1_P2_DIRECT 0x4 +#define P1_DIRECT_P2_EXTENDED 0x5 +#define P1_EXTENDED_P2_DIRECT 0x6 +#define P1_P2_EXTENDED 0x7 + +/* Extended Address Type */ +#define ASN1_BER 0x0 +#define ASN1_PER 0x1 + +/* Security Policy (dmp_sec_pol) */ +#define NATO 0x4 +#define NATIONAL 0x5 +#define EXTENDED_NATIONAL 0x6 +#define EXTENDED_MISSION 0x7 + +#define SEC_CAT_EXT_NONE 0x0 +#define SEC_CAT_EXT_PERMISSIVE 0x1 +#define SEC_CAT_EXT_RESTRICTIVE 0x2 + +/* Body Format (dmp.body_format) */ +#define FREE_TEXT 0x0 +#define FREE_TEXT_SUBJECT 0x1 +#define STRUCTURED 0x2 + +/* Encoded Information Types */ +#define EIT_BILATERAL 0x3 + +/* Compression Algorithm */ +#define ALGORITHM_NONE 0x0 +#define ALGORITHM_ZLIB 0x1 + +/* National Decoding */ +#define NAT_DECODE_NONE 0 +#define NAT_DECODE_DMP 1 +#define NAT_DECODE_THALES 2 + +#define IPM_MODIFIER_X400 0 + +/* Internal values for not present and reserved time values */ +#define DMP_TIME_NOT_PRESENT -1 +#define DMP_TIME_RESERVED -2 + +#define ILLEGAL_FORMAT "" +#define TIME_NOT_REPRESENTABLE "