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 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 #include <epan/packet.h>
25 #include "packet-link16.h"
27 /* Elmasry, G., (2012), Tactical Wireless Communications and Networks: Design Concepts and Challenges, Wiley, ISBN 9781119951766. */
29 WORDFORMAT_INITIAL = 0,
30 WORDFORMAT_CONTINUATION,
34 static const value_string WordFormat_Strings[] = {
35 { WORDFORMAT_INITIAL, "Initial Word" },
36 { WORDFORMAT_CONTINUATION, "Continuation Word" },
37 { WORDFORMAT_EXTENSION, "Extension Word" },
41 /* 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. */
42 static const value_string Link16_Label_Strings[] = {
43 { 0, "Network Management" },
44 { 1, "Network Management" },
45 { 2, "Precise Participant Location and Identification" },
46 { 3, "Surveillance" },
47 { 5, "Anti-submarine Warfare" },
48 { 6, "Intelligence" },
49 { 7, "Information Management" },
50 { 8, "Information Management" },
51 { 9, "Weapons Coordination and Management" },
52 { 10, "Weapons Coordination and Management" },
53 { 11, "Weapons Coordination and Management" },
55 { 13, "Platform and System Status" },
56 { 14, "Electronic Warfare" },
57 { 15, "Threat Warning" },
60 { 28, "National Use" },
61 { 29, "National Use" },
62 { 30, "National Use" },
63 { 31, "Miscellaneous" },
67 /* 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. */
68 #define MKPAIR(a, b) (((b) << 5) | (a))
69 static const value_string Link16_Message_Strings[] = {
70 { MKPAIR(0, 0), "Initial Entry" },
71 { MKPAIR(0, 1), "Test" },
72 { MKPAIR(0, 2), "Network Time Update" },
73 { MKPAIR(0, 3), "Time Slot Assignment" },
74 { MKPAIR(0, 4), "Radio Relay Control" },
75 { MKPAIR(0, 5), "Repromulgation Relay" },
76 { MKPAIR(0, 6), "Communication Control" },
77 { MKPAIR(0, 7), "Time Slot Reallocation" },
78 { MKPAIR(1, 0), "Connectivity Interrogation" },
79 { MKPAIR(1, 1), "Connectivity Status" },
80 { MKPAIR(1, 2), "Route Establishment" },
81 { MKPAIR(1, 3), "Acknowledgment" },
82 { MKPAIR(1, 4), "Communication Status" },
83 { MKPAIR(1, 5), "Net Control Initialization" },
84 { MKPAIR(1, 6), "Needline Participation Group Assignment" },
85 { MKPAIR(2, 0), "Indirect Interface Unit PPLI" },
86 { MKPAIR(2, 2), "Air PPLI" },
87 { MKPAIR(2, 3), "Surface PPLI" },
88 { MKPAIR(2, 4), "Subsurface PPLI" },
89 { MKPAIR(2, 5), "Land Point PPLI" },
90 { MKPAIR(2, 6), "Land Track PPLI" },
91 { MKPAIR(3, 0), "Reference Point" },
92 { MKPAIR(3, 1), "Emergency Point" },
93 { MKPAIR(3, 2), "Air Track" },
94 { MKPAIR(3, 3), "Surface Track" },
95 { MKPAIR(3, 4), "Subsurface Track" },
96 { MKPAIR(3, 5), "Land Point or Track" },
97 { MKPAIR(3, 6), "Space Track" },
98 { MKPAIR(3, 7), "Electronic Warfare Product Information" },
99 { MKPAIR(5, 4), "Acoustic Bearing and Range" },
100 { MKPAIR(6, 0), "Amplification" },
101 { MKPAIR(7, 0), "Track Management" },
102 { MKPAIR(7, 1), "Data Update Request" },
103 { MKPAIR(7, 2), "Correlation" },
104 { MKPAIR(7, 3), "Pointer" },
105 { MKPAIR(7, 4), "Track Identifier" },
106 { MKPAIR(7, 5), "IFF/SIF Management" },
107 { MKPAIR(7, 6), "Filter Management" },
108 { MKPAIR(7, 7), "Association" },
109 { MKPAIR(8, 0), "Unit Designator" },
110 { MKPAIR(8, 1), "Mission Correlator Change" },
111 { MKPAIR(9, 0), "Command" },
112 { MKPAIR(10, 2), "Engagement Status" },
113 { MKPAIR(10, 3), "Handover" },
114 { MKPAIR(10, 5), "Controlling Unit Report" },
115 { MKPAIR(10, 6), "Pairing" },
116 { MKPAIR(11, 0), "From the Weapon" },
117 { MKPAIR(11, 1), "To the Weapon" },
118 { MKPAIR(11, 2), "Weapon Coordination" },
119 { MKPAIR(12, 0), "Mission Assignment" },
120 { MKPAIR(12, 1), "Vector" },
121 { MKPAIR(12, 2), "Precision Aircraft Direction" },
122 { MKPAIR(12, 3), "Flight Path" },
123 { MKPAIR(12, 4), "Controlling Unit Change" },
124 { MKPAIR(12, 5), "Target/Track Correlation" },
125 { MKPAIR(12, 6), "Target Sorting" },
126 { MKPAIR(12, 7), "Target Bearing" },
127 { MKPAIR(13, 0), "Airfield Status" },
128 { MKPAIR(13, 2), "Air Platform and System Status" },
129 { MKPAIR(13, 3), "Surface Platform and System Status" },
130 { MKPAIR(13, 4), "Subsurface Platform and System Status" },
131 { MKPAIR(13, 5), "Land Platform and System Status" },
132 { MKPAIR(14, 0), "Parametric Information" },
133 { MKPAIR(14, 2), "Electronic Warfare Control / Coordination" },
134 { MKPAIR(15, 0), "Threat Warning" },
135 { MKPAIR(16, 0), "Imagery" },
136 { MKPAIR(17, 0), "Weather Over target" },
137 { MKPAIR(28, 0), "U.S. National 1 (Army)" },
138 { MKPAIR(28, 1), "U.S. National 2 (Navy)" },
139 { MKPAIR(28, 2), "U.S. National 3 (Air Force)" },
140 { MKPAIR(28, 3), "U.S. National 4 (Marine Corps)" },
141 { MKPAIR(28, 4), "French National 1" },
142 { MKPAIR(28, 5), "French National 2" },
143 { MKPAIR(28, 6), "U.S. National 5 (NSA)" },
144 { MKPAIR(28, 7), "UK National" },
145 { MKPAIR(31, 0), "Over-the-Air Rekeying Management" },
146 { MKPAIR(31, 1), "Over-the-Air Rekeying" },
147 { MKPAIR(31, 7), "No Statement" },
151 /* 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. */
152 const value_string Link16_NPG_Strings[] = {
153 { 1, "Initial Entry" },
156 { 4, "Network Management" },
157 { 5, "PPLI and Status" },
158 { 6, "PPLI and Status" },
159 { 7, "Surveillance" },
160 { 8, "Mission Management/Weapons Coordination" },
162 { 11, "Image Transfer" },
165 { 18, "Network Enabled Weapons" },
166 { 19, "Fighter-to-Fighter A" },
167 { 20, "Fighter-to-Fighter B" },
168 { 21, "Engagement Coordination" },
169 { 27, "Joint Net PPLI" },
170 { 28, "Distributed Network Management" },
174 static int proto_link16 = -1;
176 static gint hf_link16_wordformat = -1;
177 static gint hf_link16_label = -1;
178 static gint hf_link16_sublabel = -1;
179 static gint hf_link16_mli = -1;
180 static gint hf_link16_contlabel = -1;
182 static gint ett_link16 = -1;
184 static const int *link16_initial_word_fields[] = {
185 &hf_link16_wordformat,
192 static const int * link16_continuation_word_fields[] = {
193 &hf_link16_wordformat,
194 &hf_link16_contlabel,
198 static const int * link16_extension_or_other_word_fields[] = {
199 &hf_link16_wordformat,
203 static const int ** link16_fields[4] = {
204 link16_initial_word_fields,
205 link16_continuation_word_fields,
206 link16_extension_or_other_word_fields,
207 link16_extension_or_other_word_fields
210 static int dissect_link16(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
212 Link16State *state = (Link16State *)data;
213 proto_item *link16_item = NULL;
214 proto_tree *link16_tree = NULL;
216 guint8 wordformat, contlabel;
219 REPORT_DISSECTOR_BUG("Link 16 dissector state missing");
221 cache = tvb_get_letohs(tvb, 0);
222 wordformat = cache & 0x3;
224 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Link 16");
227 link16_item = proto_tree_add_item(tree, proto_link16, tvb, 0, -1, ENC_NA);
228 link16_tree = proto_item_add_subtree(link16_item, ett_link16);
229 proto_tree_add_bitmask_text(link16_tree, tvb, 0, 2, "Header", NULL, ett_link16, link16_fields[wordformat], ENC_LITTLE_ENDIAN, BMT_NO_APPEND);
232 /* Elmasry, G., (2012), Tactical Wireless Communications and Networks: Design Concepts and Challenges, Wiley, ISBN 9781119951766. */
233 switch (wordformat) {
234 case WORDFORMAT_INITIAL:
235 state->label = (cache >> 2) & 0x1F;
236 state->sublabel = (cache >> 7) & 0x7;
237 state->extension = 0;
238 col_append_fstr(pinfo->cinfo, COL_INFO, " J%d.%dI", state->label, state->sublabel);
240 proto_item_append_text(link16_item, " J%d.%dI", state->label, state->sublabel);
242 case WORDFORMAT_EXTENSION:
243 col_append_fstr(pinfo->cinfo, COL_INFO, " J%d.%dE%d", state->label, state->sublabel, state->extension);
245 proto_item_append_text(link16_item, " J%d.%dE%d", state->label, state->sublabel, state->extension);
248 case WORDFORMAT_CONTINUATION:
249 contlabel = (cache >> 2) & 0x1F;
250 col_append_fstr(pinfo->cinfo, COL_INFO, " J%d.%dC%d", state->label, state->sublabel, contlabel);
252 proto_item_append_text(link16_item, " J%d.%dC%d", state->label, state->sublabel, contlabel);
255 proto_item_append_text(link16_item, " %s", val_to_str_const(MKPAIR(state->label, state->sublabel), Link16_Message_Strings, "Unknown"));
257 return tvb_captured_length(tvb);
260 void proto_register_link16(void)
262 static hf_register_info hf[] = {
263 { &hf_link16_wordformat,
264 { "Word Format", "link16.wordformat", FT_UINT16, BASE_DEC, VALS(WordFormat_Strings), 0x3,
267 { "Label", "link16.label", FT_UINT16, BASE_DEC, VALS(Link16_Label_Strings), 0x7C,
269 { &hf_link16_sublabel,
270 { "Sublabel", "link16.sublabel", FT_UINT16, BASE_DEC, NULL, 0x380,
273 { "Message Length Indicator", "link16.mli", FT_UINT16, BASE_DEC, NULL, 0x1C00,
275 { &hf_link16_contlabel,
276 { "Continuation Word Label", "link16.contlabel", FT_UINT16, BASE_DEC, NULL, 0x7C,
279 static gint *ett[] = {
283 proto_link16 = proto_register_protocol("Link 16", "LINK16", "link16");
284 proto_register_field_array(proto_link16, hf, array_length (hf));
285 proto_register_subtree_array(ett, array_length(ett));
286 new_register_dissector("link16", dissect_link16, proto_link16);
289 void proto_reg_handoff_link16(void)