Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-lltd.c
blob2e97e4e0d3a0204854cd852873542a95b57743ce
1 /* packet-lltd.c
2 * Routines for LLTD dissection
3 * Copyright 2012, Michael Mann
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 #include "config.h"
14 #include <epan/packet.h>
15 #include <epan/etypes.h>
16 #include <epan/expert.h>
17 #include <epan/tfs.h>
18 #include <wsutil/array.h>
20 void proto_register_lltd(void);
21 void proto_reg_handoff_lltd(void);
23 static dissector_handle_t lltd_handle;
25 static int proto_lltd;
27 static int hf_lltd_version;
28 static int hf_lltd_type_of_service;
29 static int hf_lltd_reserved;
30 static int hf_lltd_discovery_func;
31 static int hf_lltd_discovery_real_dest_addr;
32 static int hf_lltd_discovery_real_src_addr;
33 static int hf_lltd_discovery_xid;
34 static int hf_lltd_discovery_seq_num;
35 static int hf_lltd_discover_gen_num;
36 static int hf_lltd_discover_num_stations;
37 static int hf_lltd_discover_station;
38 static int hf_lltd_hello_gen_num;
39 static int hf_lltd_hello_current_address;
40 static int hf_lltd_hello_apparent_address;
41 static int hf_lltd_tlv_type;
42 static int hf_lltd_tlv_length;
43 static int hf_lltd_host_id;
44 static int hf_lltd_char_p;
45 static int hf_lltd_char_x;
46 static int hf_lltd_char_f;
47 static int hf_lltd_char_m;
48 static int hf_lltd_char_l;
49 static int hf_lltd_char_reserved;
50 static int hf_lltd_physical_medium;
51 static int hf_lltd_wireless_mode;
52 static int hf_lltd_bssid;
53 static int hf_lltd_ssid;
54 static int hf_lltd_ipv4_address;
55 static int hf_lltd_ipv6_address;
56 static int hf_lltd_max_operation_rate;
57 static int hf_lltd_performance_count_freq;
58 static int hf_lltd_link_speed;
59 static int hf_lltd_rssi;
60 static int hf_lltd_machine_name;
61 static int hf_lltd_support_info;
62 static int hf_lltd_device_uuid;
63 static int hf_lltd_qos_char_e;
64 static int hf_lltd_qos_char_q;
65 static int hf_lltd_qos_char_p;
66 static int hf_lltd_qos_char_reserved;
67 static int hf_lltd_80211_physical_medium;
68 static int hf_lltd_sees_list_working_set;
69 static int hf_lltd_repeater_ap_lineage;
70 static int hf_lltd_emit_num_descs;
71 static int hf_lltd_emit_type;
72 static int hf_lltd_emit_pause;
73 static int hf_lltd_emit_src_addr;
74 static int hf_lltd_emit_dest_addr;
75 static int hf_lltd_queryresp_more_descs;
76 static int hf_lltd_queryresp_memory_descs;
77 static int hf_lltd_queryresp_num_descs;
78 static int hf_lltd_queryresp_type;
79 static int hf_lltd_queryresp_real_src_addr;
80 static int hf_lltd_queryresp_ethernet_src_addr;
81 static int hf_lltd_queryresp_ethernet_dest_addr;
82 static int hf_lltd_flat_crc_bytes;
83 static int hf_lltd_flat_crc_packets;
84 static int hf_lltd_query_large_tlv_type;
85 static int hf_lltd_query_large_tlv_offset;
86 static int hf_lltd_querylargeresp_more_descs;
87 static int hf_lltd_querylargeresp_memory_descs;
88 static int hf_lltd_querylargeresp_num_descs;
89 static int hf_lltd_querylargeresp_data;
91 static int hf_lltd_qos_diag_func;
92 static int hf_lltd_qos_real_dest_addr;
93 static int hf_lltd_qos_real_src_addr;
94 static int hf_lltd_qos_seq_num;
95 static int hf_lltd_qos_initialize_interrupt_mod;
96 static int hf_lltd_qos_ready_sink_link_speed;
97 static int hf_lltd_qos_ready_perf_count_freq;
98 static int hf_lltd_qos_probe_controller_transmit_timestamp;
99 static int hf_lltd_qos_probe_sink_receive_timestamp;
100 static int hf_lltd_qos_probe_sink_transmit_timestamp;
101 static int hf_lltd_qos_probe_test_type;
102 static int hf_lltd_qos_probe_packet_id;
103 static int hf_lltd_qos_probe_t;
104 static int hf_lltd_qos_probe_8021p_value;
105 static int hf_lltd_qos_probe_payload;
106 static int hf_lltd_qos_error_value;
107 static int hf_lltd_qos_count_snapshot_history;
108 static int hf_lltd_qos_query_resp_r;
109 static int hf_lltd_qos_query_resp_e;
110 static int hf_lltd_qos_query_resp_num_events;
111 static int hf_lltd_qos_query_resp_controller_timestamp;
112 static int hf_lltd_qos_query_resp_sink_timestamp;
113 static int hf_lltd_qos_query_resp_packet_id;
114 static int hf_lltd_qos_query_resp_reserved;
115 static int hf_lltd_qos_counter_result_subsec_span;
116 static int hf_lltd_qos_counter_result_byte_scale;
117 static int hf_lltd_qos_counter_result_packet_scale;
118 static int hf_lltd_qos_counter_result_history_size;
119 static int hf_lltd_qos_snapshot_bytes_recv;
120 static int hf_lltd_qos_snapshot_packets_recv;
121 static int hf_lltd_qos_snapshot_bytes_sent;
122 static int hf_lltd_qos_snapshot_packets_sent;
125 static int ett_lltd;
126 static int ett_base_header;
127 static int ett_discover_stations;
128 static int ett_tlv;
129 static int ett_tlv_item;
130 static int ett_characteristics;
131 static int ett_qos_characteristics;
132 static int ett_repeater_ap_lineage;
133 static int ett_emitee_descs;
134 static int ett_emitee_descs_item;
135 static int ett_recvee_descs;
136 static int ett_recvee_descs_item;
137 static int ett_qos_event_descs;
138 static int ett_qos_event_item;
139 static int ett_qos_snapshot_list;
140 static int ett_qos_snapshot_item;
142 static expert_field ei_lltd_tlv_length_invalid;
143 static expert_field ei_lltd_too_many_paths;
144 static expert_field ei_lltd_type_of_service;
145 static expert_field ei_lltd_char_reserved;
146 static expert_field ei_lltd_qos_seq_num;
147 static expert_field ei_lltd_discovery_func;
148 static expert_field ei_lltd_tlv_type;
149 static expert_field ei_lltd_qos_diag_func;
151 #define LLTD_CHARACTERISTIC_P_MASK 0x80000000
152 #define LLTD_CHARACTERISTIC_X_MASK 0x40000000
153 #define LLTD_CHARACTERISTIC_F_MASK 0x20000000
154 #define LLTD_CHARACTERISTIC_M_MASK 0x10000000
155 #define LLTD_CHARACTERISTIC_L_MASK 0x08000000
156 #define LLTD_CHARACTERISTIC_RESERVE_MASK 0x07FFFFFF
158 #define LLTD_QOS_CHARACTERISTIC_E_MASK 0x80000000
159 #define LLTD_QOS_CHARACTERISTIC_Q_MASK 0x40000000
160 #define LLTD_QOS_CHARACTERISTIC_P_MASK 0x20000000
161 #define LLTD_QOS_CHARACTERISTIC_RESERVE_MASK 0x1FFFFFFF
163 #define LLTD_QUERY_RESP_M_MASK 0x8000
164 #define LLTD_QUERY_RESP_E_MASK 0x4000
165 #define LLTD_QUERY_RESP_NUM_DESCS_MASK 0x3FFF
167 static const value_string lltd_tos_vals[] = {
168 { 0, "Topology discovery" },
169 { 1, "Quick discovery" },
170 { 2, "QoS Diagnostics" },
172 { 0, NULL }
175 static const value_string lltd_discovery_vals[] = {
176 { 0x00, "Discover" },
177 { 0x01, "Hello" },
178 { 0x02, "Emit" },
179 { 0x03, "Train" },
180 { 0x04, "Probe" },
181 { 0x05, "Ack" },
182 { 0x06, "Query" },
183 { 0x07, "QueryResp" },
184 { 0x08, "Reset" },
185 { 0x09, "Charge" },
186 { 0x0A, "Flat" },
187 { 0x0B, "QueryLargeTlv" },
188 { 0x0C, "QueryLargeTlvResp" },
190 { 0, NULL }
193 static const value_string lltd_qos_diag_vals[] = {
194 { 0x00, "QosInitializeSink" },
195 { 0x01, "QosReady" },
196 { 0x02, "QosProbe" },
197 { 0x03, "QosQuery" },
198 { 0x04, "QosQueryResp" },
199 { 0x05, "QosReset" },
200 { 0x06, "QosError" },
201 { 0x07, "QosAck" },
202 { 0x08, "QosCounterSnapshot" },
203 { 0x09, "QosCounterResult" },
204 { 0x0A, "QosCounterLease" },
206 { 0, NULL }
209 static const value_string lltd_tlv_type_vals[] = {
210 { 0x00, "End of Property List" },
211 { 0x01, "Host ID" },
212 { 0x02, "Characteristics" },
213 { 0x03, "Physical Medium" },
214 { 0x04, "Wireless Mode" },
215 { 0x05, "802.11 BSSID" },
216 { 0x06, "802.11 SSID" },
217 { 0x07, "IPv4 Address" },
218 { 0x08, "IPv6 Address" },
219 { 0x09, "802.11 Maximum Operation Rate" },
220 { 0x0A, "Performance Counter Frequency" },
221 { 0x0C, "Link Speed" },
222 { 0x0D, "802.11 RSSI" },
223 { 0x0E, "Icon Image" },
224 { 0x0F, "Machine Name" },
225 { 0x10, "Support Information" },
226 { 0x11, "Friendly Name" },
227 { 0x12, "Device UUID" },
228 { 0x13, "Hardware ID" },
229 { 0x14, "QoS Characteristics" },
230 { 0x15, "802.11 Physical Medium" },
231 { 0x16, "AP Association Table" },
232 { 0x18, "Detailed Icon Image" },
233 { 0x19, "Sees-List Working Set" },
234 { 0x1A, "Component Table" },
235 { 0x1B, "Repeater AP Lineage" },
236 { 0x1C, "Repeater AP Table" },
238 { 0, NULL }
241 static const value_string lltd_wireless_mode_vals[] = {
242 { 0x00, "802.11 IBSS or ad-hoc mode" },
243 { 0x01, "802.11 infrastructure mode" },
245 { 0, NULL }
248 static const value_string lltd_80211_physical_medium_vals[] = {
249 { 0x00, "Unknown" },
250 { 0x01, "FHSS 2.4 GHz" },
251 { 0x02, "DSSS 2.4 GHz" },
252 { 0x03, "IR Baseband" },
253 { 0x04, "OFDM 5 GHz" },
254 { 0x05, "HRDSSS" },
255 { 0x06, "ERP" },
257 { 0, NULL }
260 static const value_string lltd_emit_type_vals[] = {
261 { 0x00, "Train" },
262 { 0x01, "Probe" },
264 { 0, NULL }
267 static const value_string lltd_queryresp_type_vals[] = {
268 { 0x00, "Probe" },
269 { 0x01, "ARP" },
271 { 0, NULL }
274 static const value_string lltd_query_large_tlv_type_vals[] = {
275 { 0x0E, "Icon Image" },
276 { 0x11, "Friendly Name" },
277 { 0x13, "Hardware ID" },
278 { 0x16, "AP Association Table" },
279 { 0x18, "Detailed Icon Image" },
280 { 0x1A, "Component Table" },
281 { 0x1C, "Repeater AP Table" },
283 { 0, NULL }
286 static const value_string lltd_interrupt_mod_vals[] = {
287 { 0x00, "Disable interrupt moderation" },
288 { 0x01, "Enable interrupt moderation" },
289 { 0xFF, "Use existing interrupt moderation setting" },
291 { 0, NULL }
294 static const value_string lltd_qos_probe_test_type_vals[] = {
295 { 0x00, "Timed Probe" },
296 { 0x01, "Probegap originating from the controller" },
297 { 0x02, "Probegap originating from the sink" },
299 { 0, NULL }
302 static const value_string lltd_qos_error_vals[] = {
303 { 0x00, "Insufficient Resources" },
304 { 0x01, "Busy. Try again later" },
305 { 0x02, "Interrupt moderation not available" },
307 { 0, NULL }
311 static const true_false_string tfs_full_half_duplex = { "Full Duplex", "Half Duplex" };
314 static int
315 dissect_lltd_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint32_t offset, bool* end)
317 uint8_t type, length = 0;
318 proto_item *tlv_item, *type_item;
319 proto_tree *tlv_tree, *type_tree;
320 uint32_t i, temp32;
322 type = tvb_get_uint8(tvb, offset);
323 if (type == 0)
325 /* End of Property type doesn't have length */
326 tlv_tree = proto_tree_add_subtree(tree, tvb, offset, 1, ett_tlv_item, &tlv_item, "TLV Item (End of Property List)");
327 *end = true;
329 else
331 length = tvb_get_uint8(tvb, offset+1);
332 tlv_tree = proto_tree_add_subtree_format(tree, tvb, offset, length+2, ett_tlv_item, &tlv_item,
333 "TLV Item (%s)", val_to_str(type, lltd_tlv_type_vals, "Unknown (0x%02x)"));
334 *end = false;
337 proto_tree_add_item(tlv_tree, hf_lltd_tlv_type, tvb, offset, 1, ENC_NA);
338 if (type != 0)
339 proto_tree_add_item(tlv_tree, hf_lltd_tlv_length, tvb, offset+1, 1, ENC_NA);
342 if ((type != 0) && (length > tvb_reported_length_remaining(tvb, offset+2)))
344 expert_add_info_format(pinfo, tlv_item, &ei_lltd_tlv_length_invalid, "TLV Length field too big");
345 *end = true;
346 return 2;
349 switch(type)
351 case 0x00: /* End of Property List */
352 /* No data, no length field */
353 return 1;
354 case 0x01: /* Host ID */
355 if (length != 6)
357 expert_add_info_format(pinfo, tlv_item, &ei_lltd_tlv_length_invalid, "Invalid Host ID length");
360 proto_tree_add_item(tlv_tree, hf_lltd_host_id, tvb, offset+2, 6, ENC_NA);
361 break;
362 case 0x02: /* Characteristics */
363 if (length != 4)
365 expert_add_info_format(pinfo, tlv_item, &ei_lltd_tlv_length_invalid, "Characteristics length");
367 else
369 type_tree = proto_tree_add_subtree(tree, tvb, offset+2, 4, ett_characteristics, &type_item, "Characteristics");
370 proto_tree_add_item(type_tree, hf_lltd_char_p, tvb, offset+2, 4, ENC_BIG_ENDIAN);
371 proto_tree_add_item(type_tree, hf_lltd_char_x, tvb, offset+2, 4, ENC_BIG_ENDIAN);
372 proto_tree_add_item(type_tree, hf_lltd_char_f, tvb, offset+2, 4, ENC_BIG_ENDIAN);
373 proto_tree_add_item(type_tree, hf_lltd_char_m, tvb, offset+2, 4, ENC_BIG_ENDIAN);
374 proto_tree_add_item(type_tree, hf_lltd_char_l, tvb, offset+2, 4, ENC_BIG_ENDIAN);
375 proto_tree_add_item(type_tree, hf_lltd_char_reserved, tvb, offset+2, 4, ENC_BIG_ENDIAN);
376 if (tvb_get_ntohl(tvb, offset+2) & LLTD_CHARACTERISTIC_RESERVE_MASK)
377 expert_add_info(pinfo, type_item, &ei_lltd_char_reserved);
379 break;
380 case 0x03: /* Physical Medium */
381 if (length != 4)
383 expert_add_info_format(pinfo, tlv_item, &ei_lltd_tlv_length_invalid, "Invalid Physical Medium length");
386 proto_tree_add_item(tlv_tree, hf_lltd_physical_medium, tvb, offset+2, 4, ENC_BIG_ENDIAN);
387 break;
388 case 0x04: /* Wireless Mode */
389 if (length != 1)
391 expert_add_info_format(pinfo, tlv_item, &ei_lltd_tlv_length_invalid, "Invalid Wireless Mode length");
394 proto_tree_add_item(tlv_tree, hf_lltd_wireless_mode, tvb, offset+2, 1, ENC_BIG_ENDIAN);
395 break;
396 case 0x05: /* 802.11 BSSID */
397 if (length != 6)
399 expert_add_info_format(pinfo, tlv_item, &ei_lltd_tlv_length_invalid, "Invalid BSSID length");
402 proto_tree_add_item(tlv_tree, hf_lltd_bssid, tvb, offset+2, 6, ENC_NA);
403 break;
404 case 0x06: /* 802.11 SSID */
405 if (length > 32)
407 expert_add_info_format(pinfo, tlv_item, &ei_lltd_tlv_length_invalid, "SSID length too large");
410 proto_tree_add_item(tlv_tree, hf_lltd_ssid, tvb, offset+2, length, ENC_NA|ENC_ASCII);
411 break;
412 case 0x07: /* IPv4 Address */
413 if (length != 4)
415 expert_add_info_format(pinfo, tlv_item, &ei_lltd_tlv_length_invalid, "Invalid IPv4 Address length");
418 proto_tree_add_item(tlv_tree, hf_lltd_ipv4_address, tvb, offset+2, 4, ENC_BIG_ENDIAN);
419 break;
420 case 0x08: /* IPv6 Address */
421 if (length != 16)
423 expert_add_info_format(pinfo, tlv_item, &ei_lltd_tlv_length_invalid, "Invalid IPv6 Address length");
426 proto_tree_add_item(tlv_tree, hf_lltd_ipv6_address, tvb, offset+2, 16, ENC_NA);
427 break;
428 case 0x09: /* 802.11 Maximum Operation Rate */
429 if (length != 2)
431 expert_add_info_format(pinfo, tlv_item, &ei_lltd_tlv_length_invalid, "Invalid Maximum Operation Rate length");
434 proto_tree_add_item(tlv_tree, hf_lltd_max_operation_rate, tvb, offset+2, 2, ENC_BIG_ENDIAN);
435 break;
436 case 0x0A: /* Performance Counter Frequency */
437 if (length != 8)
439 expert_add_info_format(pinfo, tlv_item, &ei_lltd_tlv_length_invalid, "Invalid Performance Counter Frequency length");
442 proto_tree_add_item(tlv_tree, hf_lltd_performance_count_freq, tvb, offset+2, 8, ENC_BIG_ENDIAN);
443 break;
444 case 0x0C: /* Link Speed */
445 if (length != 4)
447 expert_add_info_format(pinfo, tlv_item, &ei_lltd_tlv_length_invalid, "Invalid Link Speed length");
450 proto_tree_add_item(tlv_tree, hf_lltd_link_speed, tvb, offset+2, 4, ENC_BIG_ENDIAN);
451 break;
452 case 0x0D: /* 802.11 RSSI */
453 if (length != 4)
455 expert_add_info_format(pinfo, tlv_item, &ei_lltd_tlv_length_invalid, "Invalid RSSI length");
458 proto_tree_add_item(tlv_tree, hf_lltd_rssi, tvb, offset+2, 4, ENC_BIG_ENDIAN);
459 break;
460 case 0x0F: /* Machine Name */
461 if (length > 32)
463 expert_add_info_format(pinfo, tlv_item, &ei_lltd_tlv_length_invalid, "Machine Name length too large");
466 proto_tree_add_item(tlv_tree, hf_lltd_machine_name, tvb, offset+2, length, ENC_LITTLE_ENDIAN|ENC_UCS_2);
467 break;
468 case 0x10: /* Support Information */
469 if (length > 64)
471 expert_add_info_format(pinfo, tlv_item, &ei_lltd_tlv_length_invalid, "Support Information length too large");
474 proto_tree_add_item(tlv_tree, hf_lltd_support_info, tvb, offset+2, length, ENC_LITTLE_ENDIAN|ENC_UCS_2);
475 break;
476 case 0x11: /* Friendly Name */
477 if (length != 0)
478 expert_add_info_format(pinfo, tlv_item, &ei_lltd_tlv_length_invalid, "Invalid Friendly Name length");
479 break;
480 case 0x12: /* Device UUID */
481 if (length != 22)
483 expert_add_info_format(pinfo, tlv_item, &ei_lltd_tlv_length_invalid, "Invalid Device UUID length");
486 proto_tree_add_item(tlv_tree, hf_lltd_device_uuid, tvb, offset+2, 22, ENC_NA);
487 break;
488 case 0x13: /* Hardware ID */
489 if (length != 0)
490 expert_add_info_format(pinfo, tlv_item, &ei_lltd_tlv_length_invalid, "Invalid Hardware ID length");
491 break;
492 case 0x14: /* QoS Characteristics */
493 if (length != 4)
495 expert_add_info_format(pinfo, tlv_item, &ei_lltd_tlv_length_invalid, "QoS Characteristics length");
497 else
499 type_tree = proto_tree_add_subtree(tlv_tree, tvb, offset+2, 4, ett_qos_characteristics, &type_item, "QoS Characteristics");
500 proto_tree_add_item(type_tree, hf_lltd_qos_char_e, tvb, offset+2, 4, ENC_BIG_ENDIAN);
501 proto_tree_add_item(type_tree, hf_lltd_qos_char_q, tvb, offset+2, 4, ENC_BIG_ENDIAN);
502 proto_tree_add_item(type_tree, hf_lltd_qos_char_p, tvb, offset+2, 4, ENC_BIG_ENDIAN);
503 proto_tree_add_item(type_tree, hf_lltd_qos_char_reserved, tvb, offset+2, 4, ENC_BIG_ENDIAN);
504 temp32 = tvb_get_ntohl(tvb, offset+2);
505 if (temp32 & LLTD_QOS_CHARACTERISTIC_RESERVE_MASK)
506 expert_add_info(pinfo, type_item, &ei_lltd_char_reserved);
508 break;
509 case 0x15: /* 802.11 Physical Medium */
510 if (length != 1)
512 expert_add_info_format(pinfo, tlv_item, &ei_lltd_tlv_length_invalid, "Invalid 802.11 Physical Medium length");
515 proto_tree_add_item(tlv_tree, hf_lltd_80211_physical_medium, tvb, offset+2, 1, ENC_BIG_ENDIAN);
516 break;
517 case 0x19: /* Sees-List Working Set */
518 if (length != 2)
520 expert_add_info_format(pinfo, tlv_item, &ei_lltd_tlv_length_invalid, "Invalid Sees-List Working Set length");
523 proto_tree_add_item(tlv_tree, hf_lltd_sees_list_working_set, tvb, offset+2, 2, ENC_BIG_ENDIAN);
524 break;
525 case 0x1B: /* Repeater AP Lineage */
526 type_tree = proto_tree_add_subtree(tree, tvb, offset+2, length, ett_repeater_ap_lineage, NULL, "Repeater AP Lineage");
527 for (i = 0; i < length; i += 6)
528 proto_tree_add_item(type_tree, hf_lltd_repeater_ap_lineage, tvb, offset+2+i, 6, ENC_NA);
530 if (length > 36)
531 expert_add_info(pinfo, tlv_item, &ei_lltd_too_many_paths);
532 break;
533 case 0x0E: /* Icon Image */
534 case 0x16: /* AP Association Table */
535 case 0x18: /* Detailed Icon Image */
536 case 0x1A: /* Component Table */
537 case 0x1C: /* Repeater AP Table */
538 if (length != 0)
539 expert_add_info_format(pinfo, tlv_item, &ei_lltd_tlv_length_invalid, "Invalid length");
540 break;
541 default:
542 expert_add_info_format(pinfo, tlv_item, &ei_lltd_tlv_type, "Invalid TLV Type 0x%02x", type);
543 break;
546 return length+2;
549 static void
550 dissect_lltd_discovery(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
552 proto_item *header_item, *func_item;
553 proto_tree *header_tree, *func_tree, *func_subtree;
554 uint8_t func;
555 uint16_t temp16;
556 bool end_tlv = false;
557 int loop_offset, start_offset;
559 func = tvb_get_uint8(tvb, offset);
560 proto_tree_add_item(tree, hf_lltd_discovery_func, tvb, offset, 1, ENC_NA);
561 col_add_str(pinfo->cinfo, COL_INFO, val_to_str(func, lltd_discovery_vals, "Unknown (0x%02x)"));
562 offset++;
564 /* Demultiplex header */
565 header_tree = proto_tree_add_subtree(tree, tvb, offset, 14, ett_base_header, &header_item, "Base header");
567 proto_tree_add_item(header_tree, hf_lltd_discovery_real_dest_addr, tvb, offset, 6, ENC_NA);
568 proto_tree_add_item(header_tree, hf_lltd_discovery_real_src_addr, tvb, offset+6, 6, ENC_NA);
569 if (func == 0)
570 proto_tree_add_item(header_tree, hf_lltd_discovery_xid, tvb, offset+12, 2, ENC_BIG_ENDIAN);
571 else
572 proto_tree_add_item(header_tree, hf_lltd_discovery_seq_num, tvb, offset+12, 2, ENC_BIG_ENDIAN);
574 switch(func)
576 case 0x00: /* Discover */
577 proto_tree_add_item(tree, hf_lltd_discover_gen_num, tvb, offset+14, 2, ENC_BIG_ENDIAN);
578 proto_tree_add_item(tree, hf_lltd_discover_num_stations, tvb, offset+16, 2, ENC_BIG_ENDIAN);
579 temp16 = tvb_get_ntohs(tvb, offset+16);
580 if (temp16 > 0)
582 func_tree = proto_tree_add_subtree(tree, tvb, offset+18, temp16*6, ett_discover_stations, NULL, "Stations");
583 for (loop_offset = 0; loop_offset < temp16*6; loop_offset += 6)
584 proto_tree_add_item(func_tree, hf_lltd_discover_station, tvb, offset+18+loop_offset, 6, ENC_NA);
586 break;
587 case 0x01: /* Hello */
588 proto_tree_add_item(tree, hf_lltd_hello_gen_num, tvb, offset+14, 2, ENC_BIG_ENDIAN);
589 proto_tree_add_item(tree, hf_lltd_hello_current_address, tvb, offset+16, 6, ENC_NA);
590 proto_tree_add_item(tree, hf_lltd_hello_apparent_address, tvb, offset+22, 6, ENC_NA);
592 func_tree = proto_tree_add_subtree(tree, tvb, offset+28, 0, ett_tlv, &func_item, "TLVs");
593 start_offset = loop_offset = offset+28;
594 while ((end_tlv == false) && (tvb_reported_length_remaining(tvb, loop_offset) >= 1))
596 loop_offset += dissect_lltd_tlv(tvb, pinfo, func_tree, loop_offset, &end_tlv);
598 proto_item_set_len(func_item, loop_offset-start_offset);
599 break;
600 case 0x02: /* Emit */
601 proto_tree_add_item(tree, hf_lltd_emit_num_descs, tvb, offset+14, 2, ENC_BIG_ENDIAN);
602 temp16 = tvb_get_ntohs(tvb, offset+14);
603 if (temp16 > 0)
605 func_tree = proto_tree_add_subtree(tree, tvb, offset+16, temp16*14, ett_emitee_descs, NULL, "EmiteeDescs");
606 for (loop_offset = 0; loop_offset < temp16*14; loop_offset += 14)
608 func_subtree = proto_tree_add_subtree(func_tree, tvb, offset+16+loop_offset, 14, ett_emitee_descs_item, NULL, "EmiteeDescs Item");
610 proto_tree_add_item(func_subtree, hf_lltd_emit_type, tvb, offset+16+loop_offset, 1, ENC_NA);
611 proto_tree_add_item(func_subtree, hf_lltd_emit_pause, tvb, offset+16+loop_offset+1, 1, ENC_NA);
612 proto_tree_add_item(func_subtree, hf_lltd_emit_src_addr, tvb, offset+16+loop_offset+2, 6, ENC_NA);
613 proto_tree_add_item(func_subtree, hf_lltd_emit_dest_addr, tvb, offset+16+loop_offset+8, 6, ENC_NA);
616 break;
617 case 0x07: /* QueryResp */
618 proto_tree_add_item(tree, hf_lltd_queryresp_more_descs, tvb, offset+14, 2, ENC_BIG_ENDIAN);
619 proto_tree_add_item(tree, hf_lltd_queryresp_memory_descs, tvb, offset+14, 2, ENC_BIG_ENDIAN);
620 proto_tree_add_item(tree, hf_lltd_queryresp_num_descs, tvb, offset+14, 2, ENC_BIG_ENDIAN);
621 temp16 = tvb_get_ntohs(tvb, offset+14) & LLTD_QUERY_RESP_NUM_DESCS_MASK;
622 if (temp16 > 0)
624 func_tree = proto_tree_add_subtree(tree, tvb, offset+16, temp16*20, ett_recvee_descs, NULL, "RecveeDescs");
625 for (loop_offset = 0; loop_offset < temp16*14; loop_offset += 20)
627 func_subtree = proto_tree_add_subtree(func_tree, tvb, offset+16+loop_offset, 20,
628 ett_recvee_descs_item, NULL, "RecveeDescs Item");
630 proto_tree_add_item(func_subtree, hf_lltd_queryresp_type, tvb, offset+16+loop_offset, 2, ENC_BIG_ENDIAN);
631 proto_tree_add_item(func_subtree, hf_lltd_queryresp_real_src_addr, tvb, offset+16+loop_offset+2, 6, ENC_NA);
632 proto_tree_add_item(func_subtree, hf_lltd_queryresp_ethernet_src_addr, tvb, offset+16+loop_offset+8, 6, ENC_NA);
633 proto_tree_add_item(func_subtree, hf_lltd_queryresp_ethernet_dest_addr, tvb, offset+16+loop_offset+14, 6, ENC_NA);
636 break;
637 case 0x0A: /* Flat */
638 proto_tree_add_item(tree, hf_lltd_flat_crc_bytes, tvb, offset+14, 4, ENC_BIG_ENDIAN);
639 proto_tree_add_item(tree, hf_lltd_flat_crc_packets, tvb, offset+18, 1, ENC_BIG_ENDIAN);
640 break;
641 case 0x0B: /* QueryLargeTlv */
642 proto_tree_add_item(tree, hf_lltd_query_large_tlv_type, tvb, offset+14, 1, ENC_BIG_ENDIAN);
643 proto_tree_add_item(tree, hf_lltd_query_large_tlv_offset, tvb, offset+15, 3, ENC_BIG_ENDIAN);
644 break;
645 case 0x0C: /* QueryLargeTlvResp */
646 proto_tree_add_item(tree, hf_lltd_querylargeresp_more_descs, tvb, offset+14, 2, ENC_BIG_ENDIAN);
647 proto_tree_add_item(tree, hf_lltd_querylargeresp_memory_descs, tvb, offset+14, 2, ENC_BIG_ENDIAN);
648 proto_tree_add_item(tree, hf_lltd_querylargeresp_num_descs, tvb, offset+14, 2, ENC_BIG_ENDIAN);
649 temp16 = tvb_get_ntohs(tvb, offset+14) & LLTD_QUERY_RESP_NUM_DESCS_MASK;
650 if (temp16 > 0)
651 proto_tree_add_item(tree, hf_lltd_querylargeresp_data, tvb, offset+16, temp16, ENC_NA);
652 break;
653 case 0x03: /* Train */
654 case 0x04: /* Probe */
655 case 0x05: /* Ack */
656 case 0x06: /* Query */
657 case 0x08: /* Reset */
658 case 0x09: /* Charge */
659 /* No data */
660 break;
661 default:
662 expert_add_info_format(pinfo, header_item, &ei_lltd_discovery_func, "Invalid function 0x%02x", func);
663 break;
667 static void
668 dissect_lltd_qos(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
670 proto_item *header_item;
671 proto_tree *header_tree, *func_tree, *func_subtree;
672 uint8_t func;
673 uint16_t seq_num, temp16;
674 int loop_offset;
676 func = tvb_get_uint8(tvb, offset);
677 proto_tree_add_item(tree, hf_lltd_qos_diag_func, tvb, offset, 1, ENC_NA);
678 col_add_str(pinfo->cinfo, COL_INFO, val_to_str(func, lltd_qos_diag_vals, "Unknown (0x%02x)"));
679 offset++;
681 header_tree = proto_tree_add_subtree(tree, tvb, offset, 14, ett_base_header, &header_item, "Base header");
683 proto_tree_add_item(header_tree, hf_lltd_qos_real_dest_addr, tvb, offset, 6, ENC_NA);
684 proto_tree_add_item(header_tree, hf_lltd_qos_real_src_addr, tvb, offset+6, 6, ENC_NA);
685 proto_tree_add_item(header_tree, hf_lltd_qos_seq_num, tvb, offset+12, 2, ENC_BIG_ENDIAN);
686 seq_num = tvb_get_ntohs(tvb, offset+12);
688 switch(func)
690 case 0x00: /* QosInitializeSink */
691 proto_tree_add_item(tree, hf_lltd_qos_initialize_interrupt_mod, tvb, offset+14, 1, ENC_BIG_ENDIAN);
692 break;
693 case 0x01: /* QosReady */
694 proto_tree_add_item(tree, hf_lltd_qos_ready_sink_link_speed, tvb, offset+14, 4, ENC_BIG_ENDIAN);
695 proto_tree_add_item(tree, hf_lltd_qos_ready_perf_count_freq, tvb, offset+18, 8, ENC_BIG_ENDIAN);
696 break;
697 case 0x02: /* QosProbe */
698 proto_tree_add_item(tree, hf_lltd_qos_probe_controller_transmit_timestamp, tvb, offset+14, 8, ENC_BIG_ENDIAN);
699 proto_tree_add_item(tree, hf_lltd_qos_probe_sink_receive_timestamp, tvb, offset+22, 8, ENC_BIG_ENDIAN);
700 proto_tree_add_item(tree, hf_lltd_qos_probe_sink_transmit_timestamp, tvb, offset+30, 8, ENC_BIG_ENDIAN);
701 proto_tree_add_item(tree, hf_lltd_qos_probe_test_type, tvb, offset+38, 1, ENC_BIG_ENDIAN);
702 proto_tree_add_item(tree, hf_lltd_qos_probe_packet_id, tvb, offset+39, 1, ENC_BIG_ENDIAN);
703 proto_tree_add_item(tree, hf_lltd_qos_probe_t, tvb, offset+40, 1, ENC_BIG_ENDIAN);
704 proto_tree_add_item(tree, hf_lltd_qos_probe_8021p_value, tvb, offset+40, 1, ENC_BIG_ENDIAN);
705 proto_tree_add_item(tree, hf_lltd_qos_probe_payload, tvb, offset+41, 5, ENC_NA);
706 break;
707 case 0x03: /* QosQuery */
708 case 0x07: /* QosAck */
709 if (seq_num == 0)
710 expert_add_info(pinfo, header_item, &ei_lltd_qos_seq_num);
711 /* No Data */
712 break;
713 case 0x04: /* QosQueryResp */
714 proto_tree_add_item(tree, hf_lltd_qos_query_resp_r, tvb, offset+14, 2, ENC_BIG_ENDIAN);
715 proto_tree_add_item(tree, hf_lltd_qos_query_resp_e, tvb, offset+14, 2, ENC_BIG_ENDIAN);
716 proto_tree_add_item(tree, hf_lltd_qos_query_resp_num_events, tvb, offset+14, 2, ENC_BIG_ENDIAN);
717 temp16 = tvb_get_ntohs(tvb, offset+14) & LLTD_QUERY_RESP_NUM_DESCS_MASK;
718 if (temp16 > 0)
720 func_tree = proto_tree_add_subtree(tree, tvb, offset+16, temp16*18, ett_qos_event_descs, NULL, "QosEventDesc");
721 for (loop_offset = 0; loop_offset < temp16*18; loop_offset += 18)
723 func_subtree = proto_tree_add_subtree(func_tree, tvb, offset+16+loop_offset, 18, ett_qos_event_item, NULL, "Qos Event");
725 proto_tree_add_item(func_subtree, hf_lltd_qos_query_resp_controller_timestamp, tvb, offset+16+loop_offset, 8, ENC_BIG_ENDIAN);
726 proto_tree_add_item(func_subtree, hf_lltd_qos_query_resp_sink_timestamp, tvb, offset+16+loop_offset+8, 8, ENC_BIG_ENDIAN);
727 proto_tree_add_item(func_subtree, hf_lltd_qos_query_resp_packet_id, tvb, offset+16+loop_offset+16, 1, ENC_BIG_ENDIAN);
728 proto_tree_add_item(func_subtree, hf_lltd_qos_query_resp_reserved, tvb, offset+16+loop_offset+17, 1, ENC_BIG_ENDIAN);
731 break;
732 case 0x05: /* QosReset */
733 /* No Data */
734 break;
735 case 0x06: /* QosError */
736 proto_tree_add_item(tree, hf_lltd_qos_error_value, tvb, offset+14, 2, ENC_BIG_ENDIAN);
737 break;
738 case 0x08: /* QosCounterSnapshot */
739 if (seq_num == 0)
740 expert_add_info(pinfo, header_item, &ei_lltd_qos_seq_num);
741 proto_tree_add_item(tree, hf_lltd_qos_count_snapshot_history, tvb, offset+14, 1, ENC_BIG_ENDIAN);
742 break;
743 case 0x09: /* QosCounterResult */
744 proto_tree_add_item(tree, hf_lltd_qos_counter_result_subsec_span, tvb, offset+14, 1, ENC_BIG_ENDIAN);
745 proto_tree_add_item(tree, hf_lltd_qos_counter_result_byte_scale, tvb, offset+15, 1, ENC_BIG_ENDIAN);
746 proto_tree_add_item(tree, hf_lltd_qos_counter_result_packet_scale, tvb, offset+16, 1, ENC_BIG_ENDIAN);
747 proto_tree_add_item(tree, hf_lltd_qos_counter_result_history_size, tvb, offset+17, 1, ENC_BIG_ENDIAN);
748 temp16 = tvb_get_uint8(tvb, offset+17);
749 if (temp16 > 0)
751 func_tree = proto_tree_add_subtree(tree, tvb, offset+18, temp16*4, ett_qos_snapshot_list, NULL, "Snapshot List");
752 for (loop_offset = 0; loop_offset < temp16*4; loop_offset += 4)
754 func_subtree = proto_tree_add_subtree(func_tree, tvb, offset+18+loop_offset, 4, ett_qos_snapshot_item, NULL, "Snapshot");
756 proto_tree_add_item(func_subtree, hf_lltd_qos_snapshot_bytes_recv, tvb, offset+16+loop_offset, 2, ENC_BIG_ENDIAN);
757 proto_tree_add_item(func_subtree, hf_lltd_qos_snapshot_packets_recv, tvb, offset+16+loop_offset+2, 2, ENC_BIG_ENDIAN);
758 proto_tree_add_item(func_subtree, hf_lltd_qos_snapshot_bytes_sent, tvb, offset+16+loop_offset+4, 2, ENC_BIG_ENDIAN);
759 proto_tree_add_item(func_subtree, hf_lltd_qos_snapshot_packets_sent, tvb, offset+16+loop_offset+6, 2, ENC_BIG_ENDIAN);
762 break;
763 case 0x0A: /* QosCounterLease */
764 /* No Data */
765 break;
766 default:
767 expert_add_info_format(pinfo, header_item, &ei_lltd_qos_diag_func, "Invalid function 0x%02x", func);
768 break;
772 static int
773 dissect_lltd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
775 proto_item *ti;
776 proto_tree *lltd_tree;
777 uint8_t tos;
779 col_set_str(pinfo->cinfo, COL_PROTOCOL, "LLTD");
780 col_clear(pinfo->cinfo, COL_INFO);
782 ti = proto_tree_add_item(tree, proto_lltd, tvb, 0, -1, ENC_NA);
783 lltd_tree = proto_item_add_subtree(ti, ett_lltd);
785 proto_tree_add_item(lltd_tree, hf_lltd_version, tvb, 0, 1, ENC_NA);
786 proto_tree_add_item(lltd_tree, hf_lltd_type_of_service, tvb, 1, 1, ENC_NA);
787 tos = tvb_get_uint8(tvb, 1);
788 proto_tree_add_item(lltd_tree, hf_lltd_reserved, tvb, 2, 1, ENC_NA);
790 switch(tos)
792 case 0: /* Topology discovery */
793 case 1: /* Quick discovery */
794 dissect_lltd_discovery(tvb, pinfo, lltd_tree, 3);
795 break;
797 case 2: /* QoS Diagnostics */
798 dissect_lltd_qos(tvb, pinfo, lltd_tree, 3);
799 break;
801 default:
802 expert_add_info_format(pinfo, ti, &ei_lltd_type_of_service, "Invalid Type of Service value 0x%02x", tos);
803 break;
806 return tvb_captured_length(tvb);
809 void
810 proto_register_lltd(void)
812 static hf_register_info hf[] = {
814 { &hf_lltd_version, {"Version", "lltd.version", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
815 { &hf_lltd_type_of_service, {"Type of Service", "lltd.tos", FT_UINT8, BASE_HEX, VALS(lltd_tos_vals), 0, NULL, HFILL }},
816 { &hf_lltd_reserved, {"Reserved", "lltd.reserved", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
817 { &hf_lltd_discovery_func, {"Discovery function", "lltd.discovery", FT_UINT8, BASE_HEX, VALS(lltd_discovery_vals), 0, NULL, HFILL }},
818 { &hf_lltd_discovery_real_dest_addr, { "Real Destination Address", "lltd.discovery.real_dest_addr", FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
819 { &hf_lltd_discovery_real_src_addr, { "Real Source Address", "lltd.discovery.real_src_addr", FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
820 { &hf_lltd_discovery_xid, {"XID", "lltd.discovery.xid", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
821 { &hf_lltd_discovery_seq_num, {"Sequence Number", "lltd.discovery.seq_num", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
822 { &hf_lltd_discover_gen_num, {"Generation Number", "lltd.discover.gen_num", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
823 { &hf_lltd_discover_num_stations, {"Number of Stations", "lltd.discover.num_stations", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
824 { &hf_lltd_discover_station, { "Station", "lltd.discover.station", FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
825 { &hf_lltd_hello_gen_num, {"Generation Number", "lltd.hello.gen_num", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
826 { &hf_lltd_hello_current_address, { "Current Mapper Address", "lltd.hello.current_address", FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
827 { &hf_lltd_hello_apparent_address, { "Current Apparent Address", "lltd.hello.apparent_address", FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
828 { &hf_lltd_tlv_type, {"Type", "lltd.tlv.type", FT_UINT8, BASE_HEX, VALS(lltd_tlv_type_vals), 0, NULL, HFILL }},
829 { &hf_lltd_tlv_length, {"Length", "lltd.tlv.length", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
830 { &hf_lltd_host_id, { "Host ID", "lltd.host_id", FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
831 { &hf_lltd_char_p, {"Public NAT", "lltd.characteristic.public_nat", FT_BOOLEAN, 32, NULL, LLTD_CHARACTERISTIC_P_MASK, NULL, HFILL }},
832 { &hf_lltd_char_x, {"Private NAT", "lltd.characteristic.private_nat", FT_BOOLEAN, 32, NULL, LLTD_CHARACTERISTIC_X_MASK, NULL, HFILL }},
833 { &hf_lltd_char_f, {"Duplex", "lltd.characteristic.duplex", FT_BOOLEAN, 32, TFS(&tfs_full_half_duplex), LLTD_CHARACTERISTIC_F_MASK, NULL, HFILL }},
834 { &hf_lltd_char_m, {"Management Web Page", "lltd.characteristic.web_page", FT_BOOLEAN, 32, TFS(&tfs_present_absent), LLTD_CHARACTERISTIC_M_MASK, NULL, HFILL }},
835 { &hf_lltd_char_l, {"Looping Outbound Packets", "lltd.characteristic.loop", FT_BOOLEAN, 32, NULL, LLTD_CHARACTERISTIC_L_MASK, NULL, HFILL }},
836 { &hf_lltd_char_reserved, {"Reserved", "lltd.characteristic.reserved", FT_UINT32, BASE_HEX, NULL, LLTD_CHARACTERISTIC_RESERVE_MASK, NULL, HFILL }},
837 { &hf_lltd_physical_medium, {"Physical Medium", "lltd.physical_medium", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
838 { &hf_lltd_wireless_mode, {"Wireless Mode", "lltd.wireless_mode", FT_UINT8, BASE_HEX, VALS(lltd_wireless_mode_vals), 0, NULL, HFILL }},
839 { &hf_lltd_bssid, { "BSSID", "lltd.bssid", FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
840 { &hf_lltd_ssid, { "SSID", "lltd.ssid", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
841 { &hf_lltd_ipv4_address, { "IPv4 Address", "lltd.ipv4_address", FT_IPv4, BASE_NONE, NULL, 0, NULL, HFILL }},
842 { &hf_lltd_ipv6_address, { "IPv6 Address", "lltd.ipv6_address", FT_IPv6, BASE_NONE, NULL, 0, NULL, HFILL }},
843 { &hf_lltd_max_operation_rate, {"Maximum Operational Rate (.5 Mbps)", "lltd.max_operation_rate", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
844 { &hf_lltd_performance_count_freq, {"Performance Counter Frequency", "lltd.performance_count_freq", FT_UINT64, BASE_DEC, NULL, 0, NULL, HFILL }},
845 { &hf_lltd_link_speed, {"Link Speed (100 bps)", "lltd.link_speed", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
846 { &hf_lltd_rssi, {"RSSI", "lltd.rssi", FT_INT32, BASE_DEC, NULL, 0, NULL, HFILL }},
847 { &hf_lltd_machine_name, { "Machine Name", "lltd.machine_name", FT_STRING /*FT_UCS2_LE */, BASE_NONE, NULL, 0, NULL, HFILL }},
848 { &hf_lltd_support_info, { "Support Information", "lltd.support_info", FT_STRING /*FT_UCS2_LE */, BASE_NONE, NULL, 0, NULL, HFILL }},
849 { &hf_lltd_device_uuid, { "Device UUID", "lltd.device_uuid", FT_GUID, BASE_NONE, NULL, 0, NULL, HFILL }},
850 { &hf_lltd_qos_char_e, {"Layer 2 Forwarding", "lltd.qos_characteristic.layer2_forwarding", FT_BOOLEAN, 32, NULL, LLTD_QOS_CHARACTERISTIC_E_MASK, NULL, HFILL }},
851 { &hf_lltd_qos_char_q, {"802.1q VLAN", "lltd.qos_characteristic.vlan", FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), LLTD_QOS_CHARACTERISTIC_Q_MASK, NULL, HFILL }},
852 { &hf_lltd_qos_char_p, {"802.1q Priority Tagging", "lltd.qos_characteristic.tagging", FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), LLTD_QOS_CHARACTERISTIC_P_MASK, NULL, HFILL }},
853 { &hf_lltd_qos_char_reserved, {"Reserved", "lltd.qos_characteristic.reserved", FT_UINT32, BASE_HEX, NULL, LLTD_QOS_CHARACTERISTIC_RESERVE_MASK, NULL, HFILL }},
854 { &hf_lltd_80211_physical_medium, {"802.11 Physical Medium", "lltd.80211_physical_medium", FT_UINT8, BASE_HEX, VALS(lltd_80211_physical_medium_vals), 0, NULL, HFILL }},
855 { &hf_lltd_sees_list_working_set, {"Sees-List Working Set", "lltd.sees_list_working_set", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
856 { &hf_lltd_repeater_ap_lineage, { "Address Path to Root", "lltd.address_path_to_root", FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
857 { &hf_lltd_emit_num_descs, {"Number of EmiteeDescs", "lltd.emit.num_descs", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
858 { &hf_lltd_emit_type, {"Type", "lltd.emit.type", FT_UINT8, BASE_HEX, VALS(lltd_emit_type_vals), 0, NULL, HFILL }},
859 { &hf_lltd_emit_pause, {"Pause (ms)", "lltd.emit.pause", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
860 { &hf_lltd_emit_src_addr, { "Source Address", "lltd.emit.src_addr", FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
861 { &hf_lltd_emit_dest_addr, { "Destination Address", "lltd.emit.dest_addr", FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
862 { &hf_lltd_queryresp_more_descs, {"More RecveeDescs", "lltd.queryresp.more", FT_BOOLEAN, 16, NULL, LLTD_QUERY_RESP_M_MASK, NULL, HFILL }},
863 { &hf_lltd_queryresp_memory_descs, {"No memory left", "lltd.queryresp.memory", FT_BOOLEAN, 16, NULL, LLTD_QUERY_RESP_E_MASK, NULL, HFILL }},
864 { &hf_lltd_queryresp_num_descs, {"Number of RecveeDescs", "lltd.queryresp.num_descs", FT_UINT16, BASE_DEC, NULL, LLTD_QUERY_RESP_NUM_DESCS_MASK, NULL, HFILL }},
865 { &hf_lltd_queryresp_type, {"Type", "lltd.queryresp.type", FT_UINT16, BASE_HEX, VALS(lltd_queryresp_type_vals), 0, NULL, HFILL }},
866 { &hf_lltd_queryresp_real_src_addr, { "Real Source Address", "lltd.queryresp.real_src_addr", FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
867 { &hf_lltd_queryresp_ethernet_src_addr, { "Ethernet Source Address", "lltd.queryresp.ethernet_src_addr", FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
868 { &hf_lltd_queryresp_ethernet_dest_addr, { "Ethernet Destination Address", "lltd.queryresp.ethernet_dest_addr", FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
869 { &hf_lltd_flat_crc_bytes, {"Current Transmit Credit (bytes)", "lltd.flat.crc_bytes", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
870 { &hf_lltd_flat_crc_packets, {"Current Transmit Credit (packets)", "lltd.flat.crc_packets", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
871 { &hf_lltd_query_large_tlv_type, {"Type", "lltd.query_large_tlv.type", FT_UINT8, BASE_HEX, VALS(lltd_query_large_tlv_type_vals), 0, NULL, HFILL }},
872 { &hf_lltd_query_large_tlv_offset, {"Offset", "lltd.query_large_tlv.offset", FT_UINT24, BASE_DEC, NULL, 0, NULL, HFILL }},
873 { &hf_lltd_querylargeresp_more_descs, {"More RecveeDescs", "lltd.querylargeresp.more", FT_BOOLEAN, 16, NULL, LLTD_QUERY_RESP_M_MASK, NULL, HFILL }},
874 { &hf_lltd_querylargeresp_memory_descs, {"No memory left", "lltd.querylargeresp.memory", FT_BOOLEAN, 16, NULL, LLTD_QUERY_RESP_E_MASK, NULL, HFILL }},
875 { &hf_lltd_querylargeresp_num_descs, {"Number of RecveeDescs", "lltd.querylargeresp.num_descs", FT_UINT16, BASE_DEC, NULL, LLTD_QUERY_RESP_NUM_DESCS_MASK, NULL, HFILL }},
876 { &hf_lltd_querylargeresp_data, { "Data", "lltd.querylargeresp.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
878 { &hf_lltd_qos_diag_func, {"QoS Diagnostics function", "lltd.qos_diag", FT_UINT8, BASE_HEX, VALS(lltd_qos_diag_vals), 0, NULL, HFILL }},
879 { &hf_lltd_qos_real_dest_addr, { "Real Destination Address", "lltd.qos.real_dest_addr", FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
880 { &hf_lltd_qos_real_src_addr, { "Real Source Address", "lltd.qos.real_src_addr", FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
881 { &hf_lltd_qos_seq_num, {"Sequence Number", "lltd.qos.seq_num", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
882 { &hf_lltd_qos_initialize_interrupt_mod, {"Interrupt Mod", "lltd.qos_initialize.interrupt_mod", FT_UINT8, BASE_HEX, VALS(lltd_interrupt_mod_vals), 0, NULL, HFILL }},
883 { &hf_lltd_qos_ready_sink_link_speed, {"Sink Link Speed (100 bps)", "lltd.qos_ready.sink_link_speed", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
884 { &hf_lltd_qos_ready_perf_count_freq, {"Performance Counter Frequency", "lltd.qos_ready.performance_count_freq", FT_UINT64, BASE_DEC, NULL, 0, NULL, HFILL }},
885 { &hf_lltd_qos_probe_controller_transmit_timestamp, {"Controller Transmit Timestamp", "lltd.qos_probe.controller_transmit_timestamp", FT_UINT64, BASE_DEC, NULL, 0, NULL, HFILL }},
886 { &hf_lltd_qos_probe_sink_receive_timestamp, {"Sink Receive Timestamp", "lltd.qos_probe.sink_receive_timestamp", FT_UINT64, BASE_DEC, NULL, 0, NULL, HFILL }},
887 { &hf_lltd_qos_probe_sink_transmit_timestamp, {"Sink Transmit Timestamp", "lltd.qos_probe.sink_transmit_timestamp", FT_UINT64, BASE_DEC, NULL, 0, NULL, HFILL }},
888 { &hf_lltd_qos_probe_test_type, {"Test Type", "lltd.qos_probe.test_type", FT_UINT8, BASE_HEX, VALS(lltd_qos_probe_test_type_vals), 0, NULL, HFILL }},
889 { &hf_lltd_qos_probe_packet_id, {"Packet ID", "lltd.qos_probe.packet_id", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
890 { &hf_lltd_qos_probe_t, {"802.1p Tag", "lltd.qos_probe.tag", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x80, NULL, HFILL }},
891 { &hf_lltd_qos_probe_8021p_value, {"802.1p Value", "lltd.qos_probe.value", FT_UINT8, BASE_DEC, NULL, 0x7F, NULL, HFILL }},
892 { &hf_lltd_qos_probe_payload, {"Payload", "lltd.qos_probe.payload", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
893 { &hf_lltd_qos_error_value, {"Error Code", "lltd.qos_error", FT_UINT16, BASE_DEC, VALS(lltd_qos_error_vals), 0, NULL, HFILL }},
894 { &hf_lltd_qos_count_snapshot_history, {"History Size", "lltd.qos_count_snapshot.history", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
895 { &hf_lltd_qos_query_resp_r, {"Receipt", "lltd.qos_query_resp.receipt", FT_BOOLEAN, 16, NULL, LLTD_QUERY_RESP_M_MASK, NULL, HFILL }},
896 { &hf_lltd_qos_query_resp_e, {"No memory left", "lltd.qos_query_resp.memory", FT_BOOLEAN, 16, NULL, LLTD_QUERY_RESP_E_MASK, NULL, HFILL }},
897 { &hf_lltd_qos_query_resp_num_events, {"Number of Events", "lltd.qos_query_resp.num_events", FT_UINT16, BASE_DEC, NULL, LLTD_QUERY_RESP_NUM_DESCS_MASK, NULL, HFILL }},
898 { &hf_lltd_qos_query_resp_controller_timestamp, {"Controller Transmit Timestamp", "lltd.qos_query_resp.controller_timestamp", FT_UINT64, BASE_DEC, NULL, 0, NULL, HFILL }},
899 { &hf_lltd_qos_query_resp_sink_timestamp, {"Sink Receive Timestamp", "lltd.qos_query_resp.sink_timestamp", FT_UINT64, BASE_DEC, NULL, 0, NULL, HFILL }},
900 { &hf_lltd_qos_query_resp_packet_id, {"Packet ID", "lltd.qos_query_resp.packet_id", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
901 { &hf_lltd_qos_query_resp_reserved, {"Reserved", "lltd.qos_query_resp.reserved", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
902 { &hf_lltd_qos_counter_result_subsec_span, {"Subsecond Span (1/256th sec)", "lltd.qos_counter_result.subsec_span", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
903 { &hf_lltd_qos_counter_result_byte_scale, {"Byte Scale (kb)", "lltd.qos_counter_result.byte_scale", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
904 { &hf_lltd_qos_counter_result_packet_scale, {"Packet Scale", "lltd.qos_counter_result.packet_scale", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
905 { &hf_lltd_qos_counter_result_history_size, {"History Size", "lltd.qos_counter_result.history_size", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
906 { &hf_lltd_qos_snapshot_bytes_recv, {"Bytes Received", "lltd.qos_snapshot.bytes_recv", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
907 { &hf_lltd_qos_snapshot_packets_recv, {"Packets Received", "lltd.qos_snapshot.packets_recv", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
908 { &hf_lltd_qos_snapshot_bytes_sent, {"Bytes Sent", "lltd.qos_snapshot.bytes_sent", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
909 { &hf_lltd_qos_snapshot_packets_sent, {"Packets Sent", "lltd.qos_snapshot.packets_sent", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}
912 static int *ett[] = {
913 &ett_lltd,
914 &ett_base_header,
915 &ett_discover_stations,
916 &ett_tlv,
917 &ett_tlv_item,
918 &ett_characteristics,
919 &ett_qos_characteristics,
920 &ett_repeater_ap_lineage,
921 &ett_emitee_descs,
922 &ett_emitee_descs_item,
923 &ett_recvee_descs,
924 &ett_recvee_descs_item,
925 &ett_qos_event_descs,
926 &ett_qos_event_item,
927 &ett_qos_snapshot_list,
928 &ett_qos_snapshot_item
931 static ei_register_info ei[] = {
932 { &ei_lltd_tlv_length_invalid, { "lltd.tlv.length.invalid", PI_MALFORMED, PI_ERROR, "Invalid length", EXPFILL }},
933 { &ei_lltd_char_reserved, { "lltd.characteristic.reserved.not_zero", PI_PROTOCOL, PI_WARN, "Non zero reserve bits", EXPFILL }},
934 { &ei_lltd_too_many_paths, { "lltd.too_many_paths", PI_PROTOCOL, PI_WARN, "Too many paths to root", EXPFILL }},
935 { &ei_lltd_tlv_type, { "lltd.tlv.type.invalid", PI_PROTOCOL, PI_WARN, "Invalid TLV Type", EXPFILL }},
936 { &ei_lltd_discovery_func, { "lltd.discovery.invalid", PI_PROTOCOL, PI_WARN, "Invalid function", EXPFILL }},
937 { &ei_lltd_qos_seq_num, { "lltd.qos.seq_num.cannot_be_zero", PI_PROTOCOL, PI_WARN, "Sequence number can not be 0", EXPFILL }},
938 { &ei_lltd_qos_diag_func, { "lltd.qos_diag.invalid", PI_PROTOCOL, PI_WARN, "Invalid function", EXPFILL }},
939 { &ei_lltd_type_of_service, { "lltd.tos.invalid", PI_PROTOCOL, PI_WARN, "Invalid Type of Service value", EXPFILL }},
942 expert_module_t* expert_lltd;
944 proto_lltd = proto_register_protocol("Link Layer Topology Discovery", "LLTD", "lltd");
945 proto_register_field_array(proto_lltd, hf, array_length(hf));
946 proto_register_subtree_array(ett, array_length(ett));
947 expert_lltd = expert_register_protocol(proto_lltd);
948 expert_register_field_array(expert_lltd, ei, array_length(ei));
950 lltd_handle = register_dissector("lltd", dissect_lltd, proto_lltd);
953 void
954 proto_reg_handoff_lltd(void)
956 dissector_add_uint("ethertype", ETHERTYPE_LLTD, lltd_handle);
960 * Editor modelines - https://www.wireshark.org/tools/modelines.html
962 * Local variables:
963 * c-basic-offset: 4
964 * tab-width: 8
965 * indent-tabs-mode: nil
966 * End:
968 * vi: set shiftwidth=4 tabstop=8 expandtab:
969 * :indentSize=4:tabSize=8:noTabs=true: