Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-simple.c
blobcaef30d046d60321c79b4e6df201b34f92481a53
1 /* packet-simple.c
2 * Routines for SIMPLE dissection
3 * Copyright 2015 Peter Ross
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
8 /* SIMPLE (Standard Interface for Multiple Platform Link Evaluation)
9 * is a protocol for exchanging tactical data link messages, such as Link 16,
10 * over Internet Protocols.
12 * The protocol is described in STANAG 5602. See:
13 * http://assistdoc1.dla.mil/qsDocDetails.aspx?ident_number=213042
16 #include "config.h"
18 #include <epan/packet.h>
19 #include <epan/tfs.h>
20 #include <wsutil/array.h>
21 #include <epan/expert.h>
22 #include "packet-link16.h"
24 void proto_reg_handoff_simple(void);
26 void proto_register_simple(void);
28 static const range_string Node_Strings[] = {
29 { 1, 128, "Unicast" },
30 { 129, 129, "Broadcast" },
31 { 160, 168, "Multicast" },
32 { 169, 169, "Adjacent" },
33 { 0, 0, NULL },
36 static const value_string Subnode_Strings[] = {
37 { 1, "RTT" },
38 { 2, "Terminal-Host Interface" },
39 { 4, "File & Mail Transfers" },
40 { 5, "Open" },
41 { 6, "Status & Control" },
42 { 7, "Time Synchronisation" },
43 { 202, "Scenario (Script)" },
44 { 203, "IJMS" },
45 { 204, "Link 4" },
46 { 205, "Link 11" },
47 { 206, "Link 16" },
48 { 207, "Link 22" },
49 { 208, "DIS" },
50 { 209, "Voice Group A" },
51 { 210, "Voice Group B" },
52 { 211, "Link 11B" },
53 { 0, NULL },
56 enum {
57 SIMPLE_LINK16 = 1,
58 SIMPLE_STATUS = 61
61 static const value_string PacketType_Strings[] = {
62 { SIMPLE_LINK16, "Link 16" },
63 { 2, "Link 11" },
64 { 3, "Link 4" },
65 { 4, "Link 22" },
66 { 5, "Interim JTIDS Message Standard (IJMS)" },
67 { 8, "Variable Message Format (VMF)" },
68 { 10, "MIDS Terminal Specific Messages (MTSM)" },
69 { 13, "MIDS/JTIDS Voice" },
70 { 20, "Link 11B" },
71 { 32, "DIS Protocol Data Unit (PDU)" },
72 { SIMPLE_STATUS, "Status/Configuration" },
73 { 62, "E-mail/File Transfer Protocol (FTP)" },
74 { 63, "Round Trip Timing (RTT)" },
75 { 65, "Time Synchronisation" },
76 { 66, "TSA Status" },
77 { 100, "National Message" },
78 { 0, NULL },
81 enum {
82 SIMPLE_LINK16_FIXED_FORMAT = 2
85 static const value_string Link16_Subtype_Strings[] = {
86 { 0, "Uncoded Free Text" },
87 { 1, "Coded Free Text" },
88 { SIMPLE_LINK16_FIXED_FORMAT, "Fixed Format" },
89 { 0, NULL },
92 static const value_string Status_Subtype_Strings[] = {
93 { 1, "Node Status" },
94 { 0, NULL },
97 static const value_string Security_Level_Strings[] = {
98 { 0, "Unclassified" },
99 { 1, "NATO Unclassified" },
100 { 2, "Confidential" },
101 { 3, "NATO Confidential" },
102 { 4, "Secret" },
103 { 5, "NATO Secret" },
104 { 6, "National Only" },
105 { 7, "Level 7" },
106 { 8, "Level 8" },
107 { 9, "Level 9" },
108 { 0, NULL },
111 static const value_string Link16_Terminal_Type[] = {
112 { 0, "None" },
113 { 1, "US Navy Air (JTIDS)" },
114 { 2, "US Navy Ship (JTIDS)" },
115 { 3, "US F-15 (JTIDS)" },
116 { 4, "US F/A-18 (MIDS)" },
117 { 5, "US Army Class 2M (JTIDS)" },
118 { 6, "US MCE (JTIDS)" },
119 { 7, "E-3 (JTIDS)" },
120 { 8, "UK Tornado F3 (JTIDS)" },
121 { 9, "UK UKADGE (JTIDS)" },
122 { 10, "Low Volume Terminal - Generic (MIDS)" },
123 { 11, "Low Volume Terminal - Platform Type A (MIDS)" },
124 { 12, "Low Volume Terminal - Platform Type B (MIDS)" },
125 { 13, "Low Volume Terminal - Platform Type C (MIDS)" },
126 { 14, "Low Volume Terminal - Platform Type D (MIDS)" },
127 { 15, "Low Volume Terminal - Platform Type E (MIDS)" },
128 { 16, "Low Volume Terminal - Platform Type F (MIDS)" },
129 { 17, "Low Volume Terminal - Platform Type G (MIDS)" },
130 { 18, "Low Volume Terminal 2, US Army (MIDS)" },
131 { 19, "Low Volume Terminal MIDS on Ship (MOS) (MIDS)" },
132 { 20, "US Fighter Data Link (FDL) (MIDS)" },
133 { 21, "AN/URC-138" },
134 { 22, "Low Volume Terminal Platform Type H (MIDS)" },
135 { 23, "Low Volume Terminal Platform Type I (MIDS)" },
136 { 0, NULL },
139 static const value_string Link16_Role[] = {
140 { 0, "None" },
141 { 1, "SIMPLE Host (SH)" },
142 { 2, "SIMPLE Terminal Emulator (STE)" },
143 { 3, "SIMPLE Network Monitor (SNM)" },
144 { 4, "SIMPLE Virtual Host (SVH)" },
145 { 5, "SIMPLE Virtual Terminal (SVT)" },
146 { 0, NULL },
149 static const value_string Link16_Sync_Status[] = {
150 { 0, "None" },
151 { 1, "Net Entry in Progress" },
152 { 2, "Coarse Sync" },
153 { 3, "Fine Sync" },
154 { 0, NULL },
157 static const value_string Link_Terminal_Host_Status[] = {
158 { 0, "Inactive" },
159 { 1, "Active" },
160 { 0, NULL },
163 static const value_string Link11_DTS_Type[] = {
164 { 0, "None" },
165 { 1, "MIL-STD-1397 parallel" },
166 { 2, "MIL-STD-188-203-1A serial" },
167 { 0, NULL },
170 static const value_string Link11_Role[] = {
171 { 0, "None"},
172 { 1, "SIMPLE DTS EMULATOR (SDE) Picket"},
173 { 2, "SDE Net Control Station (NCS)" },
174 { 3, "SIMPLE Participating Unit (PU) Emulator (SPE)" },
175 { 0, NULL },
178 static int proto_simple;
180 static dissector_handle_t simple_dissector_handle;
181 static dissector_handle_t link16_handle;
183 static int hf_simple_sync_byte_1;
184 static int hf_simple_sync_byte_2;
185 static int hf_simple_length;
186 static int hf_simple_sequence_number;
187 static int hf_simple_src_node;
188 static int hf_simple_src_subnode;
189 static int hf_simple_dst_node;
190 static int hf_simple_dst_subnode;
191 static int hf_simple_packet_size;
192 static int hf_simple_packet_type;
193 static int hf_simple_transit_time;
194 static int hf_simple_link16_subtype;
195 static int hf_simple_link16_rc;
196 static int hf_simple_link16_network;
197 static int hf_simple_link16_ssc2;
198 static int hf_simple_link16_npg;
199 static int hf_simple_link16_ssc1;
200 static int hf_simple_link16_stn;
201 static int hf_simple_link16_word_count;
202 static int hf_simple_link16_loopback_id;
203 static int hf_simple_status_subtype;
204 static int hf_simple_status_word_count;
205 static int hf_simple_status_name;
206 static int hf_simple_status_time_hours;
207 static int hf_simple_status_node_id;
208 static int hf_simple_status_time_seconds;
209 static int hf_simple_status_time_minutes;
210 static int hf_simple_status_security_level;
211 static int hf_simple_status_node_entry_flag;
212 static int hf_simple_status_relay_hop;
213 static int hf_simple_status_dx_flag_system_messages;
214 static int hf_simple_status_dx_flag_common_tims_bims;
215 static int hf_simple_status_dx_flag_common_toms_boms;
216 static int hf_simple_status_dx_flag_simple_receive;
217 static int hf_simple_status_dx_flag_simple_transmit;
218 static int hf_simple_status_dx_flag_all_tims_bims;
219 static int hf_simple_status_dx_flag_all_toms_boms;
220 static int hf_simple_status_dx_file_id;
221 static int hf_simple_status_spare_1;
222 static int hf_simple_status_link16_terminal_type;
223 static int hf_simple_status_link16_role;
224 static int hf_simple_status_link16_sync_status;
225 static int hf_simple_status_link16_terminal_host_status;
226 static int hf_simple_status_link16_stn;
227 static int hf_simple_status_spare_2;
228 static int hf_simple_status_link11_dts_type;
229 static int hf_simple_status_link11_role;
230 static int hf_simple_status_link11_pu;
231 static int hf_simple_status_link11_dts_host_status;
232 static int hf_simple_status_spare_3;
233 static int hf_simple_checksum;
234 static int hf_simple_checksum_status;
236 static int ett_simple;
237 static int ett_packet;
238 static int ett_simple_status_dx_flag;
240 static expert_field ei_simple_sync_bytes_bad;
241 static expert_field ei_simple_length_bad;
242 static expert_field ei_simple_packet_size_bad;
243 static expert_field ei_simple_checksum_bad;
245 static void dissect_simple_link16(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
247 unsigned subtype, stn, word_count, i;
248 Link16State state;
249 tvbuff_t *newtvb;
251 proto_tree_add_item(tree, hf_simple_link16_subtype, tvb, offset, 1, ENC_NA);
252 subtype = tvb_get_uint8(tvb, offset);
253 offset++;
255 proto_tree_add_item(tree, hf_simple_link16_rc, tvb, offset, 1, ENC_NA);
256 offset++;
258 proto_tree_add_item(tree, hf_simple_link16_network, tvb, offset, 1, ENC_NA);
259 offset++;
261 proto_tree_add_item(tree, hf_simple_link16_ssc2, tvb, offset, 1, ENC_NA);
262 offset++;
264 proto_tree_add_item(tree, hf_simple_link16_npg, tvb, offset, 2, ENC_LITTLE_ENDIAN);
265 offset += 2;
267 proto_tree_add_item(tree, hf_simple_link16_ssc1, tvb, offset, 2, ENC_LITTLE_ENDIAN);
268 offset += 2;
270 proto_tree_add_item(tree, hf_simple_link16_stn, tvb, offset, 2, ENC_LITTLE_ENDIAN);
271 stn = tvb_get_letohs(tvb, offset);
272 offset += 2;
274 proto_tree_add_item(tree, hf_simple_link16_word_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
275 word_count = tvb_get_uint8(tvb, offset);
276 offset += 2;
278 proto_tree_add_item(tree, hf_simple_link16_loopback_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
279 offset += 2;
281 col_append_fstr(pinfo->cinfo, COL_INFO, ", STN: %05o, Words:", stn);
283 switch(subtype) {
284 case SIMPLE_LINK16_FIXED_FORMAT:
285 memset(&state, 0, sizeof(state));
286 for (i = 0; i < word_count; i += 5) {
287 newtvb = tvb_new_subset_length_caplen(tvb, offset, 10, -1);
288 add_new_data_source(pinfo, newtvb, "Link 16 Word");
289 call_dissector_with_data(link16_handle, newtvb, pinfo, tree, &state);
290 offset += 10;
292 break;
296 static int * const simple_status_dx_flag_fields[] = {
297 &hf_simple_status_dx_flag_system_messages,
298 &hf_simple_status_dx_flag_common_tims_bims,
299 &hf_simple_status_dx_flag_common_toms_boms,
300 &hf_simple_status_dx_flag_simple_receive,
301 &hf_simple_status_dx_flag_simple_transmit,
302 &hf_simple_status_dx_flag_all_tims_bims,
303 &hf_simple_status_dx_flag_all_toms_boms,
304 NULL
307 #define SIMPLE_STATUS_NAME_LEN 10
309 static void dissect_simple_status(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
311 char *name;
312 int link16_status, pu;
314 proto_tree_add_item(tree, hf_simple_status_subtype, tvb, offset, 1, ENC_NA);
315 offset++;
317 proto_tree_add_item(tree, hf_simple_status_word_count, tvb, offset, 1, ENC_NA);
318 offset++;
320 name = tvb_get_stringzpad(pinfo->pool, tvb, offset, SIMPLE_STATUS_NAME_LEN, ENC_ASCII|ENC_NA);
321 col_append_fstr(pinfo->cinfo, COL_INFO, ", Name: %s", name);
322 proto_tree_add_item(tree, hf_simple_status_name, tvb, offset, SIMPLE_STATUS_NAME_LEN, ENC_ASCII);
323 offset += SIMPLE_STATUS_NAME_LEN;
325 proto_tree_add_item(tree, hf_simple_status_time_hours, tvb, offset, 1, ENC_NA);
326 offset++;
328 proto_tree_add_item(tree, hf_simple_status_node_id, tvb, offset, 1, ENC_NA);
329 offset++;
331 proto_tree_add_item(tree, hf_simple_status_time_seconds, tvb, offset, 1, ENC_NA);
332 offset++;
334 proto_tree_add_item(tree, hf_simple_status_time_minutes, tvb, offset, 1, ENC_NA);
335 offset++;
337 proto_tree_add_item(tree, hf_simple_status_security_level, tvb, offset, 1, ENC_NA);
338 offset++;
340 proto_tree_add_item(tree, hf_simple_status_node_entry_flag, tvb, offset, 1, ENC_NA);
341 offset++;
343 proto_tree_add_item(tree, hf_simple_status_relay_hop, tvb, offset, 16, ENC_NA);
344 offset += 16;
346 proto_tree_add_bitmask_text(tree, tvb, offset, 2, "Data Extraction Flags", NULL, ett_simple_status_dx_flag, simple_status_dx_flag_fields, ENC_LITTLE_ENDIAN, 0);
347 offset += 2;
349 proto_tree_add_item(tree, hf_simple_status_dx_file_id, tvb, offset, 8, ENC_ASCII);
350 offset += 8;
352 proto_tree_add_item(tree, hf_simple_status_spare_1, tvb, offset, 2, ENC_NA);
353 offset += 2;
355 proto_tree_add_item(tree, hf_simple_status_link16_terminal_type, tvb, offset, 1, ENC_NA);
356 offset++;
358 proto_tree_add_item(tree, hf_simple_status_link16_role, tvb, offset, 1, ENC_NA);
359 offset++;
361 proto_tree_add_item(tree, hf_simple_status_link16_sync_status, tvb, offset, 1, ENC_NA);
362 offset++;
364 proto_tree_add_item(tree, hf_simple_status_link16_terminal_host_status, tvb, offset, 1, ENC_NA);
365 link16_status = tvb_get_uint8(tvb, offset);
366 offset++;
368 proto_tree_add_item(tree, hf_simple_status_link16_stn, tvb, offset, 2, ENC_LITTLE_ENDIAN);
369 if (link16_status)
370 col_append_fstr(pinfo->cinfo, COL_INFO, ", STN: %05o", tvb_get_letohs(tvb, offset));
371 offset += 2;
373 proto_tree_add_item(tree, hf_simple_status_spare_2, tvb, offset, 2, ENC_NA);
374 offset += 2;
376 proto_tree_add_item(tree, hf_simple_status_link11_dts_type, tvb, offset, 1, ENC_NA);
377 offset++;
379 proto_tree_add_item(tree, hf_simple_status_link11_role, tvb, offset, 1, ENC_NA);
380 offset++;
382 proto_tree_add_item(tree, hf_simple_status_link11_pu, tvb, offset, 1, ENC_NA);
383 pu = tvb_get_uint8(tvb, offset);
384 offset++;
386 proto_tree_add_item(tree, hf_simple_status_link11_dts_host_status, tvb, offset, 1, ENC_NA);
387 if (tvb_get_uint8(tvb, offset))
388 col_append_fstr(pinfo->cinfo, COL_INFO, ", PU: %03o", pu);
389 offset++;
391 proto_tree_add_item(tree, hf_simple_status_spare_3, tvb, offset, 4, ENC_NA);
394 static void dissect_checksum(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
396 const uint8_t * v = tvb_get_ptr(tvb, 0, offset);
397 uint16_t expected_checksum = 0;
398 int i;
400 for (i = 0; i < offset; i++)
401 expected_checksum += v[i];
403 proto_tree_add_checksum(tree, tvb, offset, hf_simple_checksum, hf_simple_checksum_status, &ei_simple_checksum_bad, pinfo, expected_checksum,
404 ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_VERIFY);
407 static int dissect_simple(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
409 proto_item *simple_item = NULL, *item;
410 proto_tree *simple_tree = NULL, *packet_tree = NULL;
411 unsigned offset = 0, length, packet_size, packet_type;
412 const char *packet_type_string;
413 uint8_t sync_bytes_bad = 0;
415 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SIMPLE");
417 if (tree) {
418 simple_item = proto_tree_add_item(tree, proto_simple, tvb, 0, -1, ENC_NA);
419 simple_tree = proto_item_add_subtree(simple_item, ett_simple);
422 proto_tree_add_item(simple_tree, hf_simple_sync_byte_1, tvb, offset, 1, ENC_NA);
423 sync_bytes_bad |= tvb_get_uint8(tvb, offset) ^ 0x49;
424 offset++;
426 proto_tree_add_item(simple_tree, hf_simple_sync_byte_2, tvb, offset, 1, ENC_NA);
427 sync_bytes_bad |= tvb_get_uint8(tvb, offset) ^ 0x36;
428 offset++;
430 if (sync_bytes_bad)
431 expert_add_info(pinfo, simple_item, &ei_simple_sync_bytes_bad);
433 item = proto_tree_add_item(simple_tree, hf_simple_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
434 length = tvb_get_letohs(tvb, offset);
435 offset += 2;
437 if (length < 16 || length >= 518 || length > tvb_reported_length(tvb))
438 expert_add_info(pinfo, item, &ei_simple_length_bad);
440 proto_tree_add_item(simple_tree, hf_simple_sequence_number, tvb, offset, 2, ENC_LITTLE_ENDIAN);
441 offset += 2;
443 proto_tree_add_item(simple_tree, hf_simple_src_node, tvb, offset, 1, ENC_NA);
444 offset++;
446 proto_tree_add_item(simple_tree, hf_simple_src_subnode, tvb, offset, 1, ENC_NA);
447 offset++;
449 proto_tree_add_item(simple_tree, hf_simple_dst_node, tvb, offset, 1, ENC_NA);
450 offset++;
452 proto_tree_add_item(simple_tree, hf_simple_dst_subnode, tvb, offset, 1, ENC_NA);
453 offset++;
455 item = proto_tree_add_item(simple_tree, hf_simple_packet_size, tvb, offset, 1, ENC_NA);
456 packet_size = tvb_get_uint8(tvb, offset) * 2;
457 if (packet_size < 8 || packet_size - 8 > tvb_reported_length(tvb))
458 expert_add_info(pinfo, item, &ei_simple_packet_size_bad);
459 packet_size -= 8;
460 offset++;
462 proto_tree_add_item(simple_tree, hf_simple_packet_type, tvb, offset, 1, ENC_NA);
463 packet_type = tvb_get_uint8(tvb, offset);
464 offset++;
466 proto_tree_add_item(simple_tree, hf_simple_transit_time, tvb, offset, 2, ENC_LITTLE_ENDIAN);
467 offset += 2;
469 packet_type_string = val_to_str_const(packet_type, PacketType_Strings, "Unknown");
470 col_add_str(pinfo->cinfo, COL_INFO, packet_type_string);
471 packet_tree = proto_tree_add_subtree_format(simple_tree, tvb, offset, packet_size, ett_packet, NULL, "%s Packet", packet_type_string);
473 switch(packet_type) {
474 case SIMPLE_LINK16:
475 dissect_simple_link16(tvb, pinfo, packet_tree, offset);
476 break;
477 case SIMPLE_STATUS:
478 dissect_simple_status(tvb, pinfo, packet_tree, offset);
479 break;
482 dissect_checksum(tvb, pinfo, simple_tree, length - 2);
484 return tvb_captured_length(tvb);
487 void proto_register_simple(void)
489 static hf_register_info hf[] = {
490 { &hf_simple_sync_byte_1,
491 { "Sync Byte 1", "simple.sync_byte_1", FT_UINT8, BASE_HEX, NULL, 0x0,
492 NULL, HFILL }},
493 { &hf_simple_sync_byte_2,
494 { "Sync Byte 2", "simple.sync_byte_2", FT_UINT8, BASE_HEX, NULL, 0x0,
495 NULL, HFILL }},
496 { &hf_simple_length,
497 { "Length", "simple.length", FT_UINT16, BASE_DEC, NULL, 0x0,
498 NULL, HFILL }},
499 { &hf_simple_sequence_number,
500 { "Sequence Number", "simple.sequence_number", FT_UINT16, BASE_DEC, NULL, 0x0,
501 NULL, HFILL }},
502 { &hf_simple_src_node,
503 { "Source Node", "simple.src_node", FT_UINT8, BASE_RANGE_STRING | BASE_DEC, RVALS(Node_Strings), 0x0,
504 NULL, HFILL }},
505 { &hf_simple_src_subnode,
506 { "Source Subnode", "simple.src_subnode", FT_UINT8, BASE_DEC, VALS(Subnode_Strings), 0x0,
507 NULL, HFILL }},
508 { &hf_simple_dst_node,
509 { "Destination Node", "simple.dst_node", FT_UINT8, BASE_RANGE_STRING | BASE_DEC, RVALS(Node_Strings), 0x0,
510 NULL, HFILL }},
511 { &hf_simple_dst_subnode,
512 { "Destination Subnode", "simple.dst_subnode", FT_UINT8, BASE_DEC, VALS(Subnode_Strings), 0x0,
513 NULL, HFILL }},
514 { &hf_simple_packet_size,
515 { "Packet Size", "simple.packet_size", FT_UINT8, BASE_DEC, NULL, 0x0,
516 NULL, HFILL }},
517 { &hf_simple_packet_type,
518 { "Packet Type", "simple.packet_type", FT_UINT8, BASE_DEC, VALS(PacketType_Strings), 0x0,
519 NULL, HFILL }},
520 { &hf_simple_transit_time,
521 { "Transit Time", "simple.transit_time", FT_UINT16, BASE_DEC, NULL, 0x0,
522 NULL, HFILL }},
523 { &hf_simple_link16_subtype,
524 { "Subtype", "simple.link16.subtype", FT_UINT8, BASE_DEC, VALS(Link16_Subtype_Strings), 0x0,
525 NULL, HFILL }},
526 { &hf_simple_link16_rc,
527 { "R/C Flag", "simple.link16.rc", FT_BOOLEAN, BASE_NONE, TFS(&tfs_required_not_required), 0x0,
528 NULL, HFILL }},
529 { &hf_simple_link16_network,
530 { "Network", "simple.link16.network", FT_UINT8, BASE_DEC, NULL, 0x0,
531 NULL, HFILL }},
532 { &hf_simple_link16_ssc2,
533 { "Sequential Slot Count 2", "simple.link16.ssc2", FT_UINT8, BASE_DEC, NULL, 0x0,
534 NULL, HFILL }},
535 { &hf_simple_link16_npg,
536 { "NPG Number", "simple.link16.npg", FT_UINT16, BASE_DEC, VALS(Link16_NPG_Strings), 0x0,
537 NULL, HFILL }},
538 { &hf_simple_link16_ssc1,
539 { "Sequential Slot Count 1", "simple.link16.ssc1", FT_UINT16, BASE_DEC, NULL, 0x0,
540 NULL, HFILL }},
541 { &hf_simple_link16_stn,
542 { "Source Track Number", "simple.link16.stn", FT_UINT16, BASE_OCT, NULL, 0x0,
543 NULL, HFILL }},
544 { &hf_simple_link16_word_count,
545 { "Word Count", "simple.link16.word_count", FT_UINT16, BASE_DEC, NULL, 0x0,
546 NULL, HFILL }},
547 { &hf_simple_link16_loopback_id,
548 { "Loopback ID", "simple.link16.loopback_id", FT_UINT16, BASE_DEC, NULL, 0x0,
549 NULL, HFILL }},
550 { &hf_simple_status_subtype,
551 { "Subtype", "simple.status.subtype", FT_UINT8, BASE_HEX, VALS(Status_Subtype_Strings), 0x0,
552 NULL, HFILL }},
553 { &hf_simple_status_word_count,
554 { "Word Count", "simple.status.word_count", FT_UINT8, BASE_DEC, NULL, 0x0,
555 NULL, HFILL }},
556 { &hf_simple_status_name,
557 { "Name", "simple.status.name", FT_STRING, BASE_NONE, NULL, 0x0,
558 NULL, HFILL }},
559 { &hf_simple_status_time_hours,
560 { "Time (Hours)", "simple.status.time_hours", FT_UINT8, BASE_DEC, NULL, 0x0,
561 NULL, HFILL }},
562 { &hf_simple_status_node_id,
563 { "Node Id", "simple.status.node_id", FT_UINT8, BASE_DEC, NULL, 0x0,
564 NULL, HFILL }},
565 { &hf_simple_status_time_seconds,
566 { "Time (Seconds)", "simple.status.time_seconds", FT_UINT8, BASE_DEC, NULL, 0x0,
567 NULL, HFILL }},
568 { &hf_simple_status_time_minutes,
569 { "Time (Minutes)", "simple.status.time_minutes", FT_UINT8, BASE_DEC, NULL, 0x0,
570 NULL, HFILL }},
571 { &hf_simple_status_security_level,
572 { "Security Level", "simple.status.security_level", FT_UINT8, BASE_DEC, VALS(Security_Level_Strings), 0x0,
573 NULL, HFILL }},
574 { &hf_simple_status_node_entry_flag,
575 { "Node Entry Flag", "simple.status.node_entry_flag", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
576 NULL, HFILL }},
577 { &hf_simple_status_relay_hop,
578 { "Relay Hop", "simple.status.relay_hop", FT_BYTES, BASE_NONE, NULL, 0x0,
579 NULL, HFILL }},
580 { &hf_simple_status_dx_flag_system_messages,
581 { "DX System Messages", "simple.status.dx_flag.system_messages", FT_BOOLEAN, 16, NULL, 0x0001,
582 NULL, HFILL }},
583 { &hf_simple_status_dx_flag_common_tims_bims,
584 { "DX Common TIMS/BIMS", "simple.status.dx_flag.common_tims_bims", FT_BOOLEAN, 16, NULL, 0x0002,
585 NULL, HFILL }},
586 { &hf_simple_status_dx_flag_common_toms_boms,
587 { "DX Common TOMS/BOMS", "simple.status.dx_flag.common_toms_boms", FT_BOOLEAN, 16, NULL, 0x0004,
588 NULL, HFILL }},
589 { &hf_simple_status_dx_flag_simple_receive,
590 { "DX SIMPLE Receive", "simple.status.dx_flag.simple_receive", FT_BOOLEAN, 16, NULL, 0x8,
591 NULL, HFILL }},
592 { &hf_simple_status_dx_flag_simple_transmit,
593 { "DX SIMPLE Transmit", "simple.status.dx_flag.simple_transmit", FT_BOOLEAN, 16, NULL, 0x0010,
594 NULL, HFILL }},
595 { &hf_simple_status_dx_flag_all_tims_bims,
596 { "DX All TIMS/BIMS", "simple.status.dx_flag.all_tims_bims", FT_BOOLEAN, 16, NULL, 0x0020,
597 NULL, HFILL }},
598 { &hf_simple_status_dx_flag_all_toms_boms,
599 { "DX All TOMS/BOMS", "simple.status.dx_flag.all_toms_boms", FT_BOOLEAN, 16, NULL, 0x0040,
600 NULL, HFILL }},
601 { &hf_simple_status_dx_file_id,
602 { "DX File Id", "simple.status.dx_file_id", FT_STRING, BASE_NONE, NULL, 0x0,
603 NULL, HFILL }},
604 { &hf_simple_status_spare_1,
605 { "Spare1", "simple.status.spare_1", FT_BYTES, BASE_NONE, NULL, 0x0,
606 NULL, HFILL }},
607 { &hf_simple_status_link16_terminal_type,
608 { "Link 16 Type", "simple.status.link16.terminal_type", FT_UINT8, BASE_DEC, VALS(Link16_Terminal_Type), 0x0,
609 NULL, HFILL }},
610 { &hf_simple_status_link16_role,
611 { "Link 16 Role", "simple.status.link16.role", FT_UINT8, BASE_DEC, VALS(Link16_Role), 0x0,
612 NULL, HFILL }},
613 { &hf_simple_status_link16_sync_status,
614 { "Link 16 Sync Status", "simple.status.link16.sync_status", FT_UINT8, BASE_DEC, VALS(Link16_Sync_Status), 0x0,
615 NULL, HFILL }},
616 { &hf_simple_status_link16_terminal_host_status,
617 { "Link 16 Terminal/Host Status", "simple.status.link16.terminal_host_status", FT_UINT8, BASE_DEC, VALS(Link_Terminal_Host_Status), 0x0,
618 NULL, HFILL }},
619 { &hf_simple_status_link16_stn,
620 { "Link 16 STN", "simple.status.link16.stn", FT_UINT16, BASE_OCT, NULL, 0x0,
621 NULL, HFILL }},
622 { &hf_simple_status_spare_2,
623 { "Spare2", "simple.status.spare_2", FT_BYTES, BASE_NONE, NULL, 0x0,
624 NULL, HFILL }},
625 { &hf_simple_status_link11_dts_type,
626 { "Link 11 DTS Type", "simple.status.link11.dts_type", FT_UINT8, BASE_DEC, VALS(Link11_DTS_Type), 0x0,
627 NULL, HFILL }},
628 { &hf_simple_status_link11_role,
629 { "Link 11 Role", "simple.status.link11.role", FT_UINT8, BASE_DEC, VALS(Link11_Role), 0x0,
630 NULL, HFILL }},
631 { &hf_simple_status_link11_pu,
632 { "Link 11 PU", "simple.status.link11.pu", FT_UINT8, BASE_OCT, NULL, 0x0,
633 NULL, HFILL }},
634 { &hf_simple_status_link11_dts_host_status,
635 { "Link 11 DTS/Host Status", "simple.status.link11.dts_host_status", FT_UINT8, BASE_DEC, VALS(Link_Terminal_Host_Status), 0x0,
636 NULL, HFILL }},
637 { &hf_simple_status_spare_3,
638 { "Spare3", "simple.status.spare_3", FT_BYTES, BASE_NONE, NULL, 0x0,
639 NULL, HFILL }},
640 { &hf_simple_checksum,
641 { "Checksum", "simple.checksum", FT_UINT16, BASE_HEX, NULL, 0x0,
642 NULL, HFILL }},
643 { &hf_simple_checksum_status,
644 { "Checksum Status", "simple.checksum.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
645 NULL, HFILL }}
647 static int *ett[] = {
648 &ett_simple,
649 &ett_packet,
650 &ett_simple_status_dx_flag,
652 static ei_register_info ei[] = {
653 { &ei_simple_sync_bytes_bad, { "simple.sync_bytes.bad", PI_MALFORMED, PI_ERROR, "Bad sync bytes", EXPFILL }},
654 { &ei_simple_length_bad, { "simple.length.bad", PI_MALFORMED, PI_ERROR, "Bad length", EXPFILL }},
655 { &ei_simple_packet_size_bad, { "simple.packet_size.bad", PI_MALFORMED, PI_ERROR, "Bad packet length", EXPFILL }},
656 { &ei_simple_checksum_bad, { "simple.checksum.bad.expert", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }},
658 expert_module_t* expert_simple;
660 proto_simple = proto_register_protocol("Standard Interface for Multiple Platform Link Evaluation", "SIMPLE", "simple");
661 proto_register_field_array(proto_simple, hf, array_length(hf));
662 proto_register_subtree_array(ett, array_length(ett));
663 expert_simple = expert_register_protocol(proto_simple);
664 expert_register_field_array(expert_simple, ei, array_length(ei));
665 simple_dissector_handle = register_dissector("simple", dissect_simple, proto_simple);
668 void proto_reg_handoff_simple(void)
670 dissector_add_for_decode_as_with_preference("udp.port", simple_dissector_handle);
671 dissector_add_for_decode_as_with_preference("tcp.port", simple_dissector_handle);
673 link16_handle = find_dissector_add_dependency("link16", proto_simple);
677 * Editor modelines - https://www.wireshark.org/tools/modelines.html
679 * Local variables:
680 * c-basic-offset: 4
681 * tab-width: 8
682 * indent-tabs-mode: nil
683 * End:
685 * vi: set shiftwidth=4 tabstop=8 expandtab:
686 * :indentSize=4:tabSize=8:noTabs=true: