2 * Routines for Link 16 message dissection (MIL-STD-6016)
3 * William Robertson <aliask@gmail.com>
4 * Peter Ross <peter.ross@dsto.defence.gov.au>
6 * http://willrobertson.id.au/resources/wireshark/DSTO-TN-1257.pdf
8 * SPDX-License-Identifier: GPL-2.0-or-later
13 #include <epan/packet.h>
14 #include "packet-link16.h"
16 void proto_register_link16(void);
18 /* Elmasry, G., (2012), Tactical Wireless Communications and Networks: Design Concepts and Challenges, Wiley, ISBN 9781119951766. */
20 WORDFORMAT_INITIAL
= 0,
21 WORDFORMAT_CONTINUATION
,
25 static const value_string WordFormat_Strings
[] = {
26 { WORDFORMAT_INITIAL
, "Initial Word" },
27 { WORDFORMAT_CONTINUATION
, "Continuation Word" },
28 { WORDFORMAT_EXTENSION
, "Extension Word" },
32 /* Viasat, Inc., (2012), Link 16 Network Participant Group and Message Card, accessed from <http://www.viasat.com/files/assets/assets/Link16_NPG_Message_Card_100112a.pdf> on 15 April 2013. */
33 static const value_string Link16_Label_Strings
[] = {
34 { 0, "Network Management" },
35 { 1, "Network Management" },
36 { 2, "Precise Participant Location and Identification" },
37 { 3, "Surveillance" },
38 { 5, "Anti-submarine Warfare" },
39 { 6, "Intelligence" },
40 { 7, "Information Management" },
41 { 8, "Information Management" },
42 { 9, "Weapons Coordination and Management" },
43 { 10, "Weapons Coordination and Management" },
44 { 11, "Weapons Coordination and Management" },
46 { 13, "Platform and System Status" },
47 { 14, "Electronic Warfare" },
48 { 15, "Threat Warning" },
51 { 28, "National Use" },
52 { 29, "National Use" },
53 { 30, "National Use" },
54 { 31, "Miscellaneous" },
58 /* Viasat, Inc., (2012), Link 16 Network Participant Group and Message Card, accessed from <http://www.viasat.com/files/assets/assets/Link16_NPG_Message_Card_100112a.pdf> on 15 April 2013. */
59 /* SyntheSys (2021), Link 16 Messages, accessed from <https://resources.synthesys.co.uk/defence/datasheet-link-16-message-table.pdf> on 15 May 2024. */
60 #define MKPAIR(a, b) (((b) << 5) | (a))
61 static const value_string Link16_Message_Strings
[] = {
62 { MKPAIR(0, 0), "Initial Entry" },
63 { MKPAIR(0, 1), "Test" },
64 { MKPAIR(0, 2), "Network Time Update" },
65 { MKPAIR(0, 3), "Time Slot Assignment" },
66 { MKPAIR(0, 4), "Radio Relay Control" },
67 { MKPAIR(0, 5), "Repromulgation Relay" },
68 { MKPAIR(0, 6), "Communication Control" },
69 { MKPAIR(0, 7), "Time Slot Reallocation" },
70 { MKPAIR(1, 0), "Connectivity Interrogation" },
71 { MKPAIR(1, 1), "Connectivity Status" },
72 { MKPAIR(1, 2), "Route Establishment" },
73 { MKPAIR(1, 3), "Acknowledgment" },
74 { MKPAIR(1, 4), "Communication Status" },
75 { MKPAIR(1, 5), "Net Control Initialization" },
76 { MKPAIR(1, 6), "Needline Participation Group Assignment" },
77 { MKPAIR(1, 7), "Fine Pulse Count Report" },
78 { MKPAIR(2, 0), "Indirect Interface Unit PPLI" },
79 { MKPAIR(2, 2), "Air PPLI" },
80 { MKPAIR(2, 3), "Surface PPLI" },
81 { MKPAIR(2, 4), "Subsurface PPLI" },
82 { MKPAIR(2, 5), "Land Point PPLI" },
83 { MKPAIR(2, 6), "Land Track PPLI" },
84 { MKPAIR(3, 0), "Reference Point" },
85 { MKPAIR(3, 1), "Emergency Point" },
86 { MKPAIR(3, 2), "Air Track" },
87 { MKPAIR(3, 3), "Surface Track" },
88 { MKPAIR(3, 4), "Subsurface Track" },
89 { MKPAIR(3, 5), "Land Point or Track" },
90 { MKPAIR(3, 6), "Space Track" },
91 { MKPAIR(3, 7), "Electronic Warfare Product Information" },
92 { MKPAIR(5, 4), "Acoustic Bearing and Range" },
93 { MKPAIR(6, 0), "Track/Point Amplification" },
94 { MKPAIR(6, 1), "Personnel Recovery Amplification" },
95 { MKPAIR(7, 0), "Track Management" },
96 { MKPAIR(7, 1), "Data Update Request" },
97 { MKPAIR(7, 2), "Correlation" },
98 { MKPAIR(7, 3), "Pointer" },
99 { MKPAIR(7, 4), "Track Identifier" },
100 { MKPAIR(7, 5), "IFF/SIF Management" },
101 { MKPAIR(7, 6), "Filter Management" },
102 { MKPAIR(7, 7), "Association" },
103 { MKPAIR(8, 0), "Unit Designator" },
104 { MKPAIR(8, 1), "Mission Correlator Change" },
105 { MKPAIR(9, 0), "Command" },
106 { MKPAIR(9, 1), "Engagement Coordination" },
107 { MKPAIR(9, 2), "ECCM Coordination" },
108 { MKPAIR(10, 2), "Engagement Status" },
109 { MKPAIR(10, 3), "Handover" },
110 { MKPAIR(10, 5), "Controlling Unit Report" },
111 { MKPAIR(10, 6), "Pairing" },
112 { MKPAIR(11, 0), "Weapon Response/Status" },
113 { MKPAIR(11, 1), "Weapon Directive" },
114 { MKPAIR(11, 2), "Weapon Coordination" },
115 { MKPAIR(12, 0), "Mission Assignment" },
116 { MKPAIR(12, 1), "Vector" },
117 { MKPAIR(12, 2), "Precision Aircraft Direction" },
118 { MKPAIR(12, 3), "Flight Path" },
119 { MKPAIR(12, 4), "Controlling Unit Change" },
120 { MKPAIR(12, 5), "Target/Track Correlation" },
121 { MKPAIR(12, 6), "Target Sorting" },
122 { MKPAIR(12, 7), "Target Bearing" },
123 { MKPAIR(13, 0), "Airfield Status" },
124 { MKPAIR(13, 2), "Air Platform and System Status" },
125 { MKPAIR(13, 3), "Surface Platform and System Status" },
126 { MKPAIR(13, 4), "Subsurface Platform and System Status" },
127 { MKPAIR(13, 5), "Land Platform and System Status" },
128 { MKPAIR(14, 0), "Parametric Information" },
129 { MKPAIR(14, 2), "Electronic Warfare Control / Coordination" },
130 { MKPAIR(14, 3), "ECM Management" },
131 { MKPAIR(15, 0), "Threat Warning" },
132 { MKPAIR(16, 0), "Imager Transfer" },
133 { MKPAIR(16, 1), "Route Change" },
134 { MKPAIR(16, 2), "Global Area Reference System" },
135 { MKPAIR(17, 0), "Weather Over target" },
136 { MKPAIR(28, 0), "U.S. National 1 (Army)" },
137 { MKPAIR(28, 1), "U.S. National 2 (Navy)" },
138 { MKPAIR(28, 2), "U.S. National 3 (Air Force)" },
139 { MKPAIR(28, 3), "U.S. National 4 (Marine Corps)" },
140 { MKPAIR(28, 4), "French National 1" },
141 { MKPAIR(28, 5), "French National 2" },
142 { MKPAIR(28, 6), "U.S. National 5 (NSA)" },
143 { MKPAIR(28, 7), "UK National" },
144 { MKPAIR(31, 0), "Over-the-Air Rekeying Management" },
145 { MKPAIR(31, 1), "Over-the-Air Rekeying" },
146 { MKPAIR(31, 7), "No Statement" },
150 /* Viasat, Inc., (2012), Link 16 Network Participant Group and Message Card, accessed from <http://www.viasat.com/files/assets/assets/Link16_NPG_Message_Card_100112a.pdf> on 15 April 2013. */
151 /* SyntheSys (2021), Network Participation Groups (NPGs), accessed from <https://resources.synthesys.co.uk/defence/datasheet-network-participation-groups-table.pdf> on 15 May 2024. */
152 const value_string Link16_NPG_Strings
[] = {
153 { 1, "Initial Entry" },
156 { 4, "Network Management" },
157 { 5, "PPLI and Status A" },
158 { 6, "PPLI and Status B" },
159 { 7, "Surveillance" },
160 { 8, "Mission Management/Weapons Coordination" },
162 { 10, "Electronic Warfare" },
163 { 11, "Image Transfer" },
166 { 14, "Indirect PPLI" },
167 { 18, "Network Enabled Weapons" },
168 { 19, "Fighter-to-Fighter A" },
169 { 20, "Fighter-to-Fighter B" },
170 { 21, "Engagement Coordination" },
171 { 24, "Bomb Hit Indication" },
172 { 27, "Joint Net PPLI" },
173 { 28, "Distributed Network Management" },
174 { 29, "Residual Messages" },
175 { 30, "IJMS Position and Status" },
176 { 31, "Other IJMS Message" },
180 static int proto_link16
;
182 static int hf_link16_wordformat
;
183 static int hf_link16_label
;
184 static int hf_link16_sublabel
;
185 static int hf_link16_mli
;
186 static int hf_link16_contlabel
;
188 static int ett_link16
;
190 static int * const link16_initial_word_fields
[] = {
191 &hf_link16_wordformat
,
198 static int * const link16_continuation_word_fields
[] = {
199 &hf_link16_wordformat
,
200 &hf_link16_contlabel
,
204 static int * const link16_extension_or_other_word_fields
[] = {
205 &hf_link16_wordformat
,
209 static int * const *link16_fields
[4] = {
210 link16_initial_word_fields
,
211 link16_continuation_word_fields
,
212 link16_extension_or_other_word_fields
,
213 link16_extension_or_other_word_fields
216 static int dissect_link16(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
)
218 Link16State
*state
= (Link16State
*)data
;
219 proto_item
*link16_item
= NULL
;
220 proto_tree
*link16_tree
= NULL
;
222 uint8_t wordformat
, contlabel
;
225 REPORT_DISSECTOR_BUG("Link 16 dissector state missing");
227 cache
= tvb_get_letohs(tvb
, 0);
228 wordformat
= cache
& 0x3;
230 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "Link 16");
233 link16_item
= proto_tree_add_item(tree
, proto_link16
, tvb
, 0, -1, ENC_NA
);
234 link16_tree
= proto_item_add_subtree(link16_item
, ett_link16
);
235 proto_tree_add_bitmask_text(link16_tree
, tvb
, 0, 2, "Header", NULL
, ett_link16
, link16_fields
[wordformat
], ENC_LITTLE_ENDIAN
, BMT_NO_APPEND
);
238 /* Elmasry, G., (2012), Tactical Wireless Communications and Networks: Design Concepts and Challenges, Wiley, ISBN 9781119951766. */
239 switch (wordformat
) {
240 case WORDFORMAT_INITIAL
:
241 state
->label
= (cache
>> 2) & 0x1F;
242 state
->sublabel
= (cache
>> 7) & 0x7;
243 state
->extension
= 0;
244 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " J%d.%dI", state
->label
, state
->sublabel
);
246 proto_item_append_text(link16_item
, " J%d.%dI", state
->label
, state
->sublabel
);
248 case WORDFORMAT_EXTENSION
:
249 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " J%d.%dE%d", state
->label
, state
->sublabel
, state
->extension
);
251 proto_item_append_text(link16_item
, " J%d.%dE%d", state
->label
, state
->sublabel
, state
->extension
);
254 case WORDFORMAT_CONTINUATION
:
255 contlabel
= (cache
>> 2) & 0x1F;
256 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " J%d.%dC%d", state
->label
, state
->sublabel
, contlabel
);
258 proto_item_append_text(link16_item
, " J%d.%dC%d", state
->label
, state
->sublabel
, contlabel
);
261 proto_item_append_text(link16_item
, " %s", val_to_str_const(MKPAIR(state
->label
, state
->sublabel
), Link16_Message_Strings
, "Unknown"));
263 return tvb_captured_length(tvb
);
266 void proto_register_link16(void)
268 static hf_register_info hf
[] = {
269 { &hf_link16_wordformat
,
270 { "Word Format", "link16.wordformat", FT_UINT16
, BASE_DEC
, VALS(WordFormat_Strings
), 0x0003,
273 { "Label", "link16.label", FT_UINT16
, BASE_DEC
, VALS(Link16_Label_Strings
), 0x007C,
275 { &hf_link16_sublabel
,
276 { "Sublabel", "link16.sublabel", FT_UINT16
, BASE_DEC
, NULL
, 0x0380,
279 { "Message Length Indicator", "link16.mli", FT_UINT16
, BASE_DEC
, NULL
, 0x1C00,
281 { &hf_link16_contlabel
,
282 { "Continuation Word Label", "link16.contlabel", FT_UINT16
, BASE_DEC
, NULL
, 0x7C,
285 static int *ett
[] = {
289 proto_link16
= proto_register_protocol("Link 16", "LINK16", "link16");
290 proto_register_field_array(proto_link16
, hf
, array_length (hf
));
291 proto_register_subtree_array(ett
, array_length(ett
));
292 register_dissector("link16", dissect_link16
, proto_link16
);
301 * indent-tabs-mode: nil
304 * ex: set shiftwidth=4 tabstop=8 expandtab:
305 * :indentSize=4:tabSize=8:noTabs=true: