Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-lldp.c
blobb0a96b39cd4ff3db47e5f64c8421d745df779784
1 /* packet-lldp.c
2 * Routines for LLDP dissection
3 * By Juan Gonzalez <juan.gonzalez@pikatech.com>
4 * Copyright 2005 MITEL
6 * July 2005
7 * Modified by: Brian Bogora <brian_bogora@mitel.com>
9 * October 2014
10 * Modified by:
11 * Hans-Christian Goeckeritz <hans.christian.goeckeritz@gmx.de>
12 * Gregor Miernik <gregor.miernik@hytec.de>
13 * Expansion of dissector for Hytec-OUI
15 * August 2016
16 * Added Avaya IP Phone OUI, Uli Heilmeier <uh@heilmeier.eu>
18 * IEEE 802.1AB
20 * IEEE 802.1Q for the 802.1 Organizationally Specific TLVs.
22 * TIA-1057 for TIA Organizationally Specific TLVs.
24 * Wireshark - Network traffic analyzer
25 * By Gerald Combs <gerald@wireshark.org>
26 * Copyright 1998 Gerald Combs
28 * SPDX-License-Identifier: GPL-2.0-or-later
31 #include "config.h"
33 #include <epan/packet.h>
34 #include <epan/etypes.h>
35 #include <epan/afn.h>
36 #include <epan/addr_resolv.h>
37 #include <epan/expert.h>
38 #include <epan/prefs.h>
39 #include <epan/tfs.h>
40 #include <epan/unit_strings.h>
42 #include <wsutil/array.h>
43 #include <epan/oui.h>
45 #include "packet-enip.h"
47 #define DEFAULT_COLUMN_INFO 1
48 #define PROFINET_SPECIAL_COLUMN_INFO 2
50 /* Structure for general station information */
51 typedef struct _profinet_lldp_column_info {
52 /* general information */
53 char *chassis_id_mac;
54 char *chassis_id_locally_assigned;
55 char *port_id_locally_assigned;
56 bool is_nos_assigned;
57 bool is_port_id_assigned;
58 }profinet_lldp_column_info;
60 static int column_info_selection = DEFAULT_COLUMN_INFO;
61 static bool assume_unrecognized_tlv = false;
63 static dissector_handle_t lldp_handle;
65 void proto_register_lldp(void);
66 void proto_reg_handoff_lldp(void);
68 static int hf_ex_avaya_tlv_subtype;
69 static int hf_ex_avaya_hmac_shi;
70 static int hf_ex_avaya_element_type;
71 static int hf_ex_avaya_state;
72 static int hf_ex_avaya_vlan;
73 static int hf_ex_avaya_mgnt_vlan;
74 static int hf_ex_avaya_rsvd;
75 static int hf_ex_avaya_system_id;
76 static int hf_ex_avaya_status;
77 static int hf_ex_avaya_i_sid;
79 static int hf_ex_avaya2_tlv_subtype;
80 static int hf_ex_avaya2_fabric_connect;
81 static int hf_ex_avaya2_fabric_numbvlans;
82 static int hf_ex_avaya2_fabric_bvlanid;
83 static int hf_ex_avaya2_fabric_sysidlength;
84 static int hf_ex_avaya2_fabric_sysid;
86 /* Sub Dissector Tables */
87 static dissector_table_t oui_unique_code_table;
89 /* Initialize the protocol and registered fields */
90 static int proto_lldp;
91 static int hf_lldp_tlv_type;
92 static int hf_lldp_tlv_len;
93 static int hf_lldp_tlv_system_cap;
94 static int hf_lldp_tlv_system_cap_other;
95 static int hf_lldp_tlv_system_cap_repeater;
96 static int hf_lldp_tlv_system_cap_bridge;
97 static int hf_lldp_tlv_system_cap_wlan_access_pt;
98 static int hf_lldp_tlv_system_cap_router;
99 static int hf_lldp_tlv_system_cap_telephone;
100 static int hf_lldp_tlv_system_cap_docsis_cable_device;
101 static int hf_lldp_tlv_system_cap_station_only;
102 static int hf_lldp_tlv_system_cap_cvlan_component;
103 static int hf_lldp_tlv_system_cap_svlan_component;
104 static int hf_lldp_tlv_system_cap_tpmr_component;
105 static int hf_lldp_tlv_system_name;
106 static int hf_lldp_tlv_system_desc;
107 static int hf_lldp_tlv_enable_system_cap;
108 static int hf_lldp_tlv_enable_system_cap_other;
109 static int hf_lldp_tlv_enable_system_cap_repeater;
110 static int hf_lldp_tlv_enable_system_cap_bridge;
111 static int hf_lldp_tlv_enable_system_cap_wlan_access_pt;
112 static int hf_lldp_tlv_enable_system_cap_router;
113 static int hf_lldp_tlv_enable_system_cap_telephone;
114 static int hf_lldp_tlv_enable_system_cap_docsis_cable_device;
115 static int hf_lldp_tlv_enable_system_cap_station_only;
116 static int hf_lldp_tlv_enable_system_cap_cvlan_component;
117 static int hf_lldp_tlv_enable_system_cap_svlan_component;
118 static int hf_lldp_tlv_enable_system_cap_tpmr_component;
119 static int hf_chassis_id_subtype;
120 static int hf_chassis_id;
121 static int hf_chassis_id_mac;
122 static int hf_chassis_id_ip4;
123 static int hf_chassis_id_ip6;
124 static int hf_port_id_subtype;
125 static int hf_port_id;
126 static int hf_port_desc;
127 static int hf_port_id_mac;
128 static int hf_lldp_network_address_family;
129 static int hf_port_id_ip4;
130 static int hf_port_id_ip6;
131 static int hf_time_to_live;
132 static int hf_pdu_type;
133 static int hf_mgn_address_len;
134 static int hf_mgn_address_subtype;
135 static int hf_mgn_addr_ipv4;
136 static int hf_mgn_addr_ipv6;
137 static int hf_mgn_addr_hex;
138 static int hf_mgn_interface_subtype;
139 static int hf_mgn_interface_number;
140 static int hf_mgn_oid_len;
141 static int hf_mgn_obj_id;
142 static int hf_org_spc_oui;
143 static int hf_dcbx_type;
144 static int hf_dcbx_tlv_type;
145 static int hf_dcbx_tlv_len;
146 static int hf_dcbx_tlv_oper_version;
147 static int hf_dcbx_tlv_max_version;
148 static int hf_dcbx_control_sequence;
149 static int hf_dcbx_control_ack;
150 static int hf_dcbx_feature_flag_enabled;
151 static int hf_dcbx_feature_flag_error;
152 static int hf_dcbx_feature_flag_willing;
153 static int hf_dcbx_feature_subtype;
154 static int hf_dcbx_feature_pgid_reserved;
155 static int hf_dcbx_feature_pgid_prio_0;
156 static int hf_dcbx_feature_pgid_prio_1;
157 static int hf_dcbx_feature_pgid_prio_2;
158 static int hf_dcbx_feature_pgid_prio_3;
159 static int hf_dcbx_feature_pgid_prio_4;
160 static int hf_dcbx_feature_pgid_prio_5;
161 static int hf_dcbx_feature_pgid_prio_6;
162 static int hf_dcbx_feature_pgid_prio_7;
163 static int hf_dcbx_feature_pg_per_0;
164 static int hf_dcbx_feature_pg_per_1;
165 static int hf_dcbx_feature_pg_per_2;
166 static int hf_dcbx_feature_pg_per_3;
167 static int hf_dcbx_feature_pg_per_4;
168 static int hf_dcbx_feature_pg_per_5;
169 static int hf_dcbx_feature_pg_per_6;
170 static int hf_dcbx_feature_pg_per_7;
171 static int hf_dcbx_feature_pg_numtcs;
172 static int hf_dcbx_feature_pfc_prio0;
173 static int hf_dcbx_feature_pfc_prio1;
174 static int hf_dcbx_feature_pfc_prio2;
175 static int hf_dcbx_feature_pfc_prio3;
176 static int hf_dcbx_feature_pfc_prio4;
177 static int hf_dcbx_feature_pfc_prio5;
178 static int hf_dcbx_feature_pfc_prio6;
179 static int hf_dcbx_feature_pfc_prio7;
180 static int hf_dcbx_feature_pfc_numtcs;
181 static int hf_dcbx_feature_app_proto;
182 static int hf_dcbx_feature_app_selector;
183 static int hf_dcbx_feature_app_oui;
184 static int hf_dcbx_feature_app_prio;
185 static int hf_dcbx_feature_flag_llink_type;
186 static int hf_ieee_802_1_subtype;
187 static int hf_ieee_802_1_port_and_vlan_id_flag;
188 static int hf_ieee_802_1_port_and_vlan_id_flag_supported;
189 static int hf_ieee_802_1_port_and_vlan_id_flag_enabled;
190 static int hf_ieee_802_1_port_vlan_id;
191 static int hf_ieee_802_1_port_proto_vlan_id;
192 static int hf_ieee_802_1_vlan_id;
193 static int hf_ieee_802_1_vlan_name_length;
194 static int hf_ieee_802_1_vlan_name;
195 static int hf_ieee_802_1_proto_id_length;
196 static int hf_ieee_802_1_proto_id;
197 static int hf_ieee_802_1_aggregation_status;
198 static int hf_ieee_802_1_aggregation_status_cap;
199 static int hf_ieee_802_1_aggregation_status_enabled;
200 static int hf_ieee_802_1_aggregation_status_porttype;
201 static int hf_ieee_802_1_aggregated_port_id;
202 static int hf_ieee_8021qau_cnpv_prio0;
203 static int hf_ieee_8021qau_cnpv_prio1;
204 static int hf_ieee_8021qau_cnpv_prio2;
205 static int hf_ieee_8021qau_cnpv_prio3;
206 static int hf_ieee_8021qau_cnpv_prio4;
207 static int hf_ieee_8021qau_cnpv_prio5;
208 static int hf_ieee_8021qau_cnpv_prio6;
209 static int hf_ieee_8021qau_cnpv_prio7;
210 static int hf_ieee_8021qau_ready_prio0;
211 static int hf_ieee_8021qau_ready_prio1;
212 static int hf_ieee_8021qau_ready_prio2;
213 static int hf_ieee_8021qau_ready_prio3;
214 static int hf_ieee_8021qau_ready_prio4;
215 static int hf_ieee_8021qau_ready_prio5;
216 static int hf_ieee_8021qau_ready_prio6;
217 static int hf_ieee_8021qau_ready_prio7;
218 static int hf_ieee_8021az_feature_flag_willing;
219 static int hf_ieee_8021az_feature_flag_cbs;
220 static int hf_ieee_8021az_maxtcs;
221 static int hf_ieee_8021az_tsa_class0;
222 static int hf_ieee_8021az_tsa_class1;
223 static int hf_ieee_8021az_tsa_class2;
224 static int hf_ieee_8021az_tsa_class3;
225 static int hf_ieee_8021az_tsa_class4;
226 static int hf_ieee_8021az_tsa_class5;
227 static int hf_ieee_8021az_tsa_class6;
228 static int hf_ieee_8021az_tsa_class7;
229 static int hf_ieee_8021az_feature_flag_mbc;
230 static int hf_ieee_8021az_pfc_numtcs;
231 static int hf_ieee_8021az_app_reserved;
232 static int hf_ieee_8021az_app_prio;
233 static int hf_ieee_8021az_app_selector;
234 static int hf_ieee_802_3_subtype;
235 static int hf_ieee_802_3_mac_phy_auto_neg_status;
236 static int hf_ieee_802_3_mac_phy_auto_neg_status_supported;
237 static int hf_ieee_802_3_mac_phy_auto_neg_status_enabled;
238 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps;
239 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_1000base_tfd;
240 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_1000base_t;
241 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_1000base_xfd;
242 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_1000base_x;
243 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_fdx_bpause;
244 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_fdx_spause;
245 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_fdx_apause;
246 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_fdx_pause;
247 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_100base_t2fd;
248 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_100base_t2;
249 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_100base_txfd;
250 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_100base_tx;
251 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_100base_t4;
252 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_10base_tfd;
253 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_10base_t;
254 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_other;
255 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_1000base_tfd;
256 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_1000base_t;
257 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_1000base_xfd;
258 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_1000base_x;
259 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_fdx_bpause;
260 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_fdx_spause;
261 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_fdx_apause;
262 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_fdx_pause;
263 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_100base_t2fd;
264 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_100base_t2;
265 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_100base_txfd;
266 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_100base_tx;
267 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_100base_t4;
268 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_10base_tfd;
269 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_10base_t;
270 static int hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_other;
271 static int hf_ieee_802_3_pmd_mau_type;
272 static int hf_ieee_802_3_mdi_power_support;
273 static int hf_ieee_802_3_mdi_power_support_port_class;
274 static int hf_ieee_802_3_mdi_power_support_pse_power_support;
275 static int hf_ieee_802_3_mdi_power_support_pse_power_enabled;
276 static int hf_ieee_802_3_mdi_power_support_pse_pairs;
277 static int hf_ieee_802_3_mdi_power_pse_pair;
278 static int hf_ieee_802_3_mdi_power_class;
279 static int hf_ieee_802_3_mdi_power_type;
280 static int hf_ieee_802_3_mdi_power_source;
281 static int hf_ieee_802_3_mdi_power_pd4pid;
282 static int hf_ieee_802_3_mdi_power_priority;
283 static int hf_ieee_802_3_mdi_requested_power;
284 static int hf_ieee_802_3_mdi_allocated_power;
286 static int hf_ieee_802_3_bt_ds_pd_requested_power_value_mode_a;
287 static int hf_ieee_802_3_bt_ds_pd_requested_power_value_mode_b;
288 static int hf_ieee_802_3_bt_ds_pse_allocated_power_value_alt_a;
289 static int hf_ieee_802_3_bt_ds_pse_allocated_power_value_alt_b;
290 static int hf_ieee_802_3_bt_power_status;
291 static int hf_ieee_802_3_bt_pse_powering_status;
292 static int hf_ieee_802_3_bt_pd_powered_status;
293 static int hf_ieee_802_3_bt_pse_power_pairs_ext;
294 static int hf_ieee_802_3_bt_ds_pwr_class_ext_a;
295 static int hf_ieee_802_3_bt_ds_pwr_class_ext_b;
296 static int hf_ieee_802_3_bt_pwr_class_ext;
297 static int hf_ieee_802_3_bt_system_setup;
298 static int hf_ieee_802_3_bt_power_type_ext;
299 static int hf_ieee_802_3_bt_power_pd_load;
300 static int hf_ieee_802_3_bt_pse_maximum_available_power_value;
301 static int hf_ieee_802_3_bt_autoclass;
302 static int hf_ieee_802_3_bt_pse_autoclass_support;
303 static int hf_ieee_802_3_bt_autoclass_completed;
304 static int hf_ieee_802_3_bt_autoclass_request;
305 static int hf_ieee_802_3_bt_autoclass_reserved;
306 static int hf_ieee_802_3_bt_power_down;
307 static int hf_ieee_802_3_bt_power_down_request;
308 static int hf_ieee_802_3_bt_power_down_time;
309 static int hf_ieee_802_3_aggregation_status;
310 static int hf_ieee_802_3_aggregation_status_cap;
311 static int hf_ieee_802_3_aggregation_status_enabled;
312 static int hf_ieee_802_3_aggregated_port_id;
313 static int hf_ieee_802_3_max_frame_size;
314 static int hf_ieee_802_3_eee_transmit;
315 static int hf_ieee_802_3_eee_receive;
316 static int hf_ieee_802_3_eee_fallback_receive;
317 static int hf_ieee_802_3_eee_echo_transmit;
318 static int hf_ieee_802_3_eee_echo_receive;
319 static int hf_ieee_802_1qbg_subtype;
320 static int hf_ieee_802_1qbg_evb_support_caps;
321 static int hf_ieee_802_1qbg_evb_support_caps_std;
322 static int hf_ieee_802_1qbg_evb_support_caps_rr;
323 static int hf_ieee_802_1qbg_evb_support_caps_rte;
324 static int hf_ieee_802_1qbg_evb_support_caps_ecp;
325 static int hf_ieee_802_1qbg_evb_support_caps_vdp;
326 static int hf_ieee_802_1qbg_evb_configure_caps;
327 static int hf_ieee_802_1qbg_evb_configure_caps_std;
328 static int hf_ieee_802_1qbg_evb_configure_caps_rr;
329 static int hf_ieee_802_1qbg_evb_configure_caps_rte;
330 static int hf_ieee_802_1qbg_evb_configure_caps_ecp;
331 static int hf_ieee_802_1qbg_evb_configure_caps_vdp;
332 static int hf_ieee_802_1qbg_evb_supported_vsi;
333 static int hf_ieee_802_1qbg_evb_configured_vsi;
334 static int hf_ieee_802_1qbg_evb_retrans_timer;
335 static int hf_ieee_802_3br_aec;
336 static int hf_ieee_802_3br_aec_support;
337 static int hf_ieee_802_3br_aec_enable;
338 static int hf_ieee_802_3br_aec_active;
339 static int hf_ieee_802_3br_aec_addfragsize;
340 static int hf_ieee_802_3br_aec_reserved;
341 static int hf_media_tlv_subtype;
342 static int hf_media_tlv_subtype_caps;
343 static int hf_media_tlv_subtype_caps_llpd;
344 static int hf_media_tlv_subtype_caps_network_policy;
345 static int hf_media_tlv_subtype_caps_location_id;
346 static int hf_media_tlv_subtype_caps_mdi_pse;
347 static int hf_media_tlv_subtype_caps_mid_pd;
348 static int hf_media_tlv_subtype_caps_inventory;
349 static int hf_media_tlv_subtype_class;
350 static int hf_media_application_type;
351 static int hf_media_policy_flag;
352 static int hf_media_tag_flag;
353 static int hf_media_vlan_id;
354 static int hf_media_l2_prio;
355 static int hf_media_dscp;
356 static int hf_media_loc_data_format;
357 static int hf_media_loc_lat_resolution;
358 static int hf_media_loc_lat;
359 static int hf_media_loc_long_resolution;
360 static int hf_media_loc_long;
361 static int hf_media_loc_alt_type;
362 static int hf_media_loc_alt_resolution;
363 static int hf_media_loc_alt;
364 static int hf_media_loc_ver;
365 static int hf_media_loc_reserved;
366 static int hf_media_loc_datum;
367 static int hf_media_civic_lci_length;
368 static int hf_media_civic_what;
369 static int hf_media_civic_country;
370 static int hf_media_civic_addr_type;
371 static int hf_media_civic_addr_len;
372 static int hf_media_civic_addr_value;
373 static int hf_media_ecs;
374 static int hf_media_power_type;
375 static int hf_media_power_source;
376 static int hf_media_power_priority;
377 static int hf_media_power_value;
378 static int hf_media_hardware;
379 static int hf_media_firmware;
380 static int hf_media_software;
381 static int hf_media_sn;
382 static int hf_media_manufacturer;
383 static int hf_media_model;
384 static int hf_media_asset;
385 static int hf_profinet_tlv_subtype;
386 static int hf_profinet_class2_port_status;
387 static int hf_profinet_class3_port_status;
388 static int hf_profinet_class3_port_status_Fragmentation;
389 static int hf_profinet_class3_port_status_reserved;
390 static int hf_profinet_class3_port_status_PreambleLength;
391 static int hf_profinet_port_rx_delay_local;
392 static int hf_profinet_port_rx_delay_remote;
393 static int hf_profinet_port_tx_delay_local;
394 static int hf_profinet_port_tx_delay_remote;
395 static int hf_profinet_cable_delay_local;
396 static int hf_profinet_mrp_domain_uuid;
397 static int hf_profinet_tsn_domain_uuid;
398 static int hf_profinet_tsn_nme_management_addr;
399 static int hf_profinet_tsn_nme_management_addr_str_length;
400 static int hf_profinet_tsn_nme_management_addr_subtype;
401 static int hf_profinet_tsn_nme_name_uuid;
402 static int hf_profinet_tsn_nme_parameter_uuid;
403 static int hf_profinet_time_domain_number;
404 static int hf_profinet_time_domain_uuid;
405 static int hf_profinet_time_domain_master_identity;
406 static int hf_profinet_mrrt_port_status;
407 static int hf_profinet_cm_mac;
408 static int hf_profinet_master_source_address;
409 static int hf_profinet_subdomain_uuid;
410 static int hf_profinet_ir_data_uuid;
411 static int hf_profinet_length_of_period_valid;
412 static int hf_profinet_length_of_period_length;
413 static int hf_profinet_red_period_begin_valid;
414 static int hf_profinet_red_period_begin_offset;
415 static int hf_profinet_orange_period_begin_valid;
416 static int hf_profinet_orange_period_begin_offset;
417 static int hf_profinet_green_period_begin_valid;
418 static int hf_profinet_green_period_begin_offset;
419 static int hf_cisco_subtype;
420 static int hf_cisco_upoe;
421 static int hf_cisco_upoe_supported;
422 static int hf_cisco_upoe_altb_detection;
423 static int hf_cisco_upoe_req_spare_pair;
424 static int hf_cisco_upoe_pse_spare_pair_oper;
425 static int hf_cisco_aci_portstate;
426 static int hf_cisco_aci_noderole;
427 static int hf_cisco_aci_nodeid;
428 static int hf_cisco_aci_spinelevel;
429 static int hf_cisco_aci_podid;
430 static int hf_cisco_aci_fabricname;
431 static int hf_cisco_aci_apiclist;
432 static int hf_cisco_aci_apicid;
433 static int hf_cisco_aci_apicipv4;
434 static int hf_cisco_aci_apicuuid;
435 static int hf_cisco_aci_nodeip;
436 static int hf_cisco_aci_portrole;
437 static int hf_cisco_aci_version;
438 static int hf_cisco_aci_fabricvlan;
439 static int hf_cisco_aci_serialno;
440 static int hf_cisco_aci_model;
441 static int hf_cisco_aci_nodename;
442 static int hf_cisco_aci_portmode;
443 static int hf_cisco_aci_authcookie;
444 static int hf_cisco_aci_apicmode;
445 static int hf_cisco_aci_fabricid;
446 static int hf_hytec_tlv_subtype;
447 static int hf_hytec_group;
448 static int hf_hytec_identifier;
449 static int hf_hytec_transceiver_vendor_product_revision;
450 static int hf_hytec_single_mode;
451 static int hf_hytec_multi_mode_50;
452 static int hf_hytec_multi_mode_62_5;
453 static int hf_hytec_tx_current_output_power;
454 static int hf_hytec_rx_current_input_power;
455 static int hf_hytec_rx_input_snr;
456 static int hf_hytec_lineloss;
457 static int hf_hytec_mac_trace_request;
458 static int hf_hytec_trace_mac_address;
459 static int hf_hytec_request_mac_address;
460 static int hf_hytec_maximum_depth;
461 static int hf_hytec_mac_trace_reply;
462 static int hf_hytec_answering_mac_address;
463 static int hf_hytec_actual_depth;
464 static int hf_hytec_name_of_replying_device;
465 static int hf_hytec_outgoing_port_name;
466 static int hf_hytec_ipv4_address_of_replying_device;
467 static int hf_hytec_end_of_trace;
468 static int hf_hytec_ipv6_address_of_replying_device;
469 static int hf_hytec_incoming_port_name;
470 static int hf_hytec_trace_identifier;
471 static int hf_hytec_invalid_object_data;
472 static int hf_hytec_unknown_identifier_content;
473 static int hf_avaya_subtype;
474 static int hf_avaya_poe;
475 static int hf_avaya_call_server;
476 static int hf_avaya_cna_server;
477 static int hf_avaya_file_server;
478 static int hf_avaya_dot1q;
479 static int hf_avaya_ipphone;
480 static int hf_avaya_ipphone_ip;
481 static int hf_avaya_ipphone_mask;
482 static int hf_avaya_ipphone_gateway;
483 static int hf_unknown_subtype;
484 static int hf_unknown_subtype_content;
485 static int hf_subtype_content_remaining;
486 static int hf_iana_subtype;
487 static int hf_iana_mudurl;
488 static int hf_onos_subtype;
489 static int hf_onos_chassis;
490 static int hf_onos_port;
491 static int hf_onos_ttl;
493 /* Initialize the subtree pointers */
494 static int ett_lldp;
495 static int ett_chassis_id;
496 static int ett_port_id;
497 static int ett_time_to_live;
498 static int ett_end_of_lldpdu;
499 static int ett_port_description;
500 static int ett_system_name;
501 static int ett_system_desc;
502 static int ett_system_cap;
503 static int ett_system_cap_summary;
504 static int ett_system_cap_enabled;
505 static int ett_management_address;
506 static int ett_unknown_tlv;
507 static int ett_org_spc_def;
508 static int ett_org_spc_dcbx_cin;
509 static int ett_org_spc_dcbx_cee;
510 static int ett_org_spc_dcbx_cee_1;
511 static int ett_org_spc_dcbx_cee_2;
512 static int ett_org_spc_dcbx_cee_3;
513 static int ett_org_spc_dcbx_cee_4;
514 static int ett_org_spc_dcbx_cin_6;
515 static int ett_org_spc_dcbx_cee_app;
516 static int ett_org_spc_ieee_802_1_1;
517 static int ett_org_spc_ieee_802_1_2;
518 static int ett_org_spc_ieee_802_1_3;
519 static int ett_org_spc_ieee_802_1_4;
520 static int ett_org_spc_ieee_802_1_8;
521 static int ett_org_spc_ieee_802_1_9;
522 static int ett_org_spc_ieee_802_1_a;
523 static int ett_org_spc_ieee_802_1_b;
524 static int ett_org_spc_ieee_802_1_c;
525 static int ett_org_spc_ieee_dcbx_app;
527 static int ett_org_spc_ieee_802_3_1;
528 static int ett_org_spc_ieee_802_3_2;
529 static int ett_org_spc_ieee_802_3_3;
530 static int ett_org_spc_ieee_802_3_4;
531 static int ett_org_spc_ieee_802_3_5;
532 static int ett_org_spc_ieee_802_3_7;
534 static int ett_org_spc_media_1;
535 static int ett_org_spc_media_2;
536 static int ett_org_spc_media_3;
537 static int ett_org_spc_media_4;
538 static int ett_org_spc_media_5;
539 static int ett_org_spc_media_6;
540 static int ett_org_spc_media_7;
541 static int ett_org_spc_media_8;
542 static int ett_org_spc_media_9;
543 static int ett_org_spc_media_10;
544 static int ett_org_spc_media_11;
546 static int ett_ex_avayaSubTypes_11;
547 static int ett_ex_avayaSubTypes_12;
548 static int ett_ex_avaya2SubTypes_4;
549 static int ett_org_spc_ProfinetSubTypes_1;
550 static int ett_org_spc_ProfinetSubTypes_2;
551 static int ett_org_spc_ProfinetSubTypes_3;
552 static int ett_org_spc_ProfinetSubTypes_4;
553 static int ett_org_spc_ProfinetSubTypes_5;
554 static int ett_org_spc_ProfinetSubTypes_6;
555 static int ett_org_spc_tlv;
556 static int ett_port_vlan_flags;
557 static int ett_802_3_flags;
558 static int ett_802_3_autoneg_advertised;
559 static int ett_802_3_power;
560 static int ett_802_3_bt_power;
561 static int ett_802_3_bt_system_setup;
562 static int ett_802_3_bt_autoclass;
563 static int ett_802_3_bt_power_down;
564 static int ett_802_3_aggregation;
565 static int ett_802_1_aggregation;
566 static int ett_802_1qbg_capabilities_flags;
567 static int ett_802_3br_capabilities_flags;
568 static int ett_media_capabilities;
569 static int ett_profinet_period;
570 static int ett_cisco_upoe_tlv;
571 static int ett_avaya_ipphone_tlv;
572 static int ett_org_spc_hytec_subtype_transceiver;
573 static int ett_org_spc_hytec_subtype_trace;
574 static int ett_org_spc_hytec_trace_request;
575 static int ett_org_spc_hytec_trace_reply;
577 static expert_field ei_lldp_bad_length;
578 static expert_field ei_lldp_bad_length_excess;
579 static expert_field ei_lldp_shutdown_excess_tlv;
580 static expert_field ei_lldp_bad_type;
581 static expert_field ei_lldp_tlv_deprecated;
583 /* TLV Types */
584 #define END_OF_LLDPDU_TLV_TYPE 0x00
585 #define CHASSIS_ID_TLV_TYPE 0x01 /* Mandatory */
586 #define PORT_ID_TLV_TYPE 0x02 /* Mandatory */
587 #define TIME_TO_LIVE_TLV_TYPE 0x03 /* Mandatory */
588 #define PORT_DESCRIPTION_TLV_TYPE 0x04
589 #define SYSTEM_NAME_TLV_TYPE 0x05
590 #define SYSTEM_DESCRIPTION_TLV_TYPE 0x06
591 #define SYSTEM_CAPABILITIES_TLV_TYPE 0x07
592 #define MANAGEMENT_ADDR_TLV_TYPE 0x08
593 #define ORGANIZATION_SPECIFIC_TLV_TYPE 0x7F
595 /* Masks */
596 #define TLV_TYPE_MASK 0xFE00
597 #define TLV_TYPE(value) (((value) & TLV_TYPE_MASK) >> 9)
598 #define TLV_INFO_LEN_MASK 0x01FF
599 #define TLV_INFO_LEN(value) ((value) & TLV_INFO_LEN_MASK)
601 static const value_string tlv_types[] = {
602 { END_OF_LLDPDU_TLV_TYPE, "End of LLDPDU"},
603 { CHASSIS_ID_TLV_TYPE, "Chassis Id"},
604 { PORT_ID_TLV_TYPE, "Port Id"},
605 { TIME_TO_LIVE_TLV_TYPE, "Time to Live"},
606 { PORT_DESCRIPTION_TLV_TYPE, "Port Description"},
607 { SYSTEM_NAME_TLV_TYPE, "System Name"},
608 { SYSTEM_DESCRIPTION_TLV_TYPE, "System Description"},
609 { SYSTEM_CAPABILITIES_TLV_TYPE, "System Capabilities"},
610 { MANAGEMENT_ADDR_TLV_TYPE, "Management Address"},
611 { ORGANIZATION_SPECIFIC_TLV_TYPE, "Organization Specific"},
612 { 0, NULL}
615 static const value_string chassis_id_subtypes[] = {
616 { 0, "Reserved"},
617 { 1, "Chassis component"},
618 { 2, "Interface alias"},
619 { 3, "Port component"},
620 { 4, "MAC address"},
621 { 5, "Network address"},
622 { 6, "Interface name"},
623 { 7, "Locally assigned"},
624 { 0, NULL}
627 static const value_string porttype_values[] = {
628 { 0, "Not specified"},
629 { 1, "From aggregation port"},
630 { 2, "From aggregator"},
631 { 3, "From single-port aggregator"},
632 { 0, NULL}
635 static const value_string port_id_subtypes[] = {
636 { 0, "Reserved"},
637 { 1, "Interface alias"},
638 { 2, "Port component"},
639 { 3, "MAC address"},
640 { 4, "Network address"},
641 { 5, "Interface name"},
642 { 6, "Agent circuit Id"},
643 { 7, "Locally assigned"},
644 { 0, NULL}
647 static const value_string interface_subtype_values[] = {
648 { 1, "Unknown"},
649 { 2, "ifIndex"},
650 { 3, "System port number"},
651 { 0, NULL}
654 static const value_string dcbx_protocol_types[] = {
655 { 0x01, "1.0 CIN" },
656 { 0x02, "1.01 CEE" },
657 { 0, NULL }
660 static const value_string dcbx_subtypes[] = {
661 { 0x01, "DCBx Control" },
662 { 0x02, "Priority Groups" },
663 { 0x03, "Priority-Based Flow Control" },
664 { 0x04, "Application Protocol" },
665 { 0x06, "Logical Link Down" },
666 { 0, NULL }
669 static const value_string dcbx_app_selector[] = {
670 { 0, "EtherType" },
671 { 1, "Socket Number" },
672 { 0, NULL }
675 static const value_string dcbx_app_types[] = {
676 { 0xcbc, "iSCSI" },
677 { 0x8906, "FCoE" },
678 { 0x8914, "FiP" },
679 { 0, NULL }
682 static const value_string dcbx_llink_types[] = {
683 { 0x0, "FCoE Status" },
684 { 0x1, "LAN Status" },
685 { 0, NULL }
688 /* IEEE 802.1 Subtypes */
689 static const value_string ieee_802_1_subtypes[] = {
690 { 0x01, "Port VLAN ID" }, /* 802.1Q - D.2.1 */
691 { 0x02, "Port and Protocol VLAN ID" }, /* 802.1Q - D.2.2 */
692 { 0x03, "VLAN Name" }, /* 802.1Q - D.2.3 */
693 { 0x04, "Protocol Identity" }, /* 802.1Q - D.2.4 */
694 { 0x05, "VID Usage Digest" }, /* 802.1Q - D.2.5 */
695 { 0x06, "Management VID" }, /* 802.1Q - D.2.6 */
696 { 0x07, "Link Aggregation" }, /* 802.1Q - D.2.7 */
697 { 0x08, "Congestion Notification" }, /* 802.1Q - D.2.8 */
698 { 0x09, "ETS Configuration" }, /* 802.1Q - D.2.9 */
699 { 0x0A, "ETS Recommendation" }, /* 802.1Q - D.2.10 */
700 { 0x0B, "Priority Flow Control Configuration" },/* 802.1Q - D.2.11 */
701 { 0x0C, "Application Protocol" }, /* 802.1Q - D.2.12 */
702 { 0x0D, "EVB" }, /* 802.1Q - D.2.13 */
703 { 0x0E, "CDCP" }, /* 802.1Q - D.2.14 */
704 { 0x0F, "Port extension" }, /* 802.1BR - B.2 */
705 { 0x10, "Application VLAN" }, /* 802.1Q - D.2.15 */
706 { 0x11, "LRP ECP Discovery" }, /* 802.1CS - C.2.1 */
707 { 0x12, "LRP TCP Discovery" }, /* 802.1CS - C.2.2 */
708 { 0x13, "Congestion Isolation" }, /* 802.1Qcz - D.2.15 */
709 { 0x14, "Topology Recognition" }, /* 802.1Qcz - D.2.16 */
710 { 0, NULL }
713 static const value_string dcbx_ieee_8021az_tsa[] = {
714 { 0, "Strict Priority" },
715 { 1, "Credit-Based Shaper" },
716 { 2, "Enhanced Transmission Selection" },
717 /* All other bits Reserved */
718 { 255, "Vendor Specific Algorithm" },
719 { 0, NULL }
722 static const value_string dcbx_ieee_8021az_sf[] = {
723 { 0, "Reserved" },
724 { 1, "Default or Ethertype" },
725 { 2, "Port over TCP/SCTP" },
726 { 3, "Port over UDP/DCCP" },
727 { 4, "Port over TCP/SCTP/UDP/DCCP" },
728 { 5, "Reserved" },
729 { 6, "Reserved" },
730 { 7, "Reserved" },
731 { 0, NULL }
734 /* IEEE 802.3 Subtypes */
735 static const value_string ieee_802_3_subtypes[] = {
736 { 0x01, "MAC/PHY Configuration/Status" },
737 { 0x02, "Power Via MDI" },
738 { 0x03, "Link Aggregation" },
739 { 0x04, "Maximum Frame Size" },
740 { 0x05, "EEE (Energy-Efficient Ethernet)" },
741 { 0x07, "IEEE 802.3br Additional Ethernet capabilities" },
742 { 0, NULL }
745 /* Media Subtypes */
746 static const value_string media_subtypes[] = {
747 { 1, "Media Capabilities" },
748 { 2, "Network Policy" },
749 { 3, "Location Identification" },
750 { 4, "Extended Power-via-MDI" },
751 { 5, "Inventory - Hardware Revision" },
752 { 6, "Inventory - Firmware Revision" },
753 { 7, "Inventory - Software Revision" },
754 { 8, "Inventory - Serial Number" },
755 { 9, "Inventory - Manufacturer Name" },
756 { 10, "Inventory - Model Name" },
757 { 11, "Inventory - Asset ID" },
758 { 0, NULL }
761 /* Media Class Values */
762 static const value_string media_class_values[] = {
763 { 0, "Type Not Defined" },
764 { 1, "Endpoint Class I" },
765 { 2, "Endpoint Class II" },
766 { 3, "Endpoint Class III" },
767 { 4, "Network Connectivity" },
768 { 0, NULL }
771 /* Media Application Types */
772 static const value_string media_application_type[] = {
773 { 0, "Reserved" },
774 { 1, "Voice" },
775 { 2, "Voice Signaling" },
776 { 3, "Guest Voice" },
777 { 4, "Guest Voice Signaling" },
778 { 5, "Softphone Voice" },
779 { 6, "Video Conferencing" },
780 { 7, "Streaming Video" },
781 { 8, "Video Signaling" },
782 { 0, NULL }
785 /* PROFINET subtypes */
786 static const value_string profinet_subtypes[] = {
787 { 1, "Measured Delay Values" },
788 { 2, "Port Status" },
789 { 3, "Alias" },
790 { 4, "MRP Port Status" },
791 { 5, "Chassis MAC" },
792 { 6, "PTCP Status" },
793 { 7, "MauType Extension" },
794 { 8, "MRPIC Port Status" },
795 { 9, "TSN Domain"},
796 { 10, "TSN NME Management Address"},
797 { 11, "TSN NME Name UUID"},
798 { 12, "TSN NME Parameter UUID"},
799 { 13, "AS Working Clock"},
800 { 14, "AS Global Time"},
801 { 0, NULL }
803 /* extreme avaya ap subtypes */
804 #define EX_AVAYA_SUBTYPE_ELEMENT_TLV 11
805 #define EX_AVAYA_SUBTYPE_ASSIGNMENT_TLV 12
806 static const value_string ex_avaya_subtypes[] = {
807 { EX_AVAYA_SUBTYPE_ELEMENT_TLV, "Extreme Fabric Attach Element TLV" },
808 { EX_AVAYA_SUBTYPE_ASSIGNMENT_TLV, "Extreme Fabric Attach Assignment TLV" },
809 { 0, NULL }
812 /* extreme avaya2 (fabric) subtypes */
813 #define EX_AVAYA2_SUBTYPE_ZTFv2_FC_TLV 4
814 static const value_string ex_avaya2_subtypes[] = {
815 { EX_AVAYA2_SUBTYPE_ZTFv2_FC_TLV, "Extreme Zero Touch Fabric v2 Fabric Connect TLV" },
816 { 0, NULL }
819 /* ONOS subtypes */
820 /* https://github.com/opennetworkinglab/onos/blob/master/utils/misc/src/main/java/org/onlab/packet/LLDP.java */
821 #define ONOS_CHASSIS_TLV_TYPE 1
822 #define ONOS_PORT_TLV_TYPE 2
823 #define ONOS_TTL_TLV_TYPE 3
824 static const value_string onos_subtypes[] = {
825 { ONOS_CHASSIS_TLV_TYPE, "ONOS Chassis" },
826 { ONOS_PORT_TLV_TYPE, "ONOS Port" },
827 { ONOS_TTL_TLV_TYPE, "ONOS TTL" },
828 { 0, NULL }
832 /* Cisco Subtypes */
833 static const value_string cisco_subtypes[] = {
834 /* UPOE: https://www.cisco.com/c/dam/en/us/solutions/collateral/workforce-experience/digital-building/digital-building-partner-guide.pdf */
835 { 0x01, "4-wire Power-via-MDI (UPOE)" },
836 /* ACI */
837 { 0xc9, "ACI Port State" },
838 { 0xca, "ACI Node Role" },
839 { 0xcb, "ACI Node ID" },
840 { 0xcc, "ACI Spine Level" },
841 { 0xcd, "ACI Pod ID" },
842 { 0xce, "ACI Fabric Name" },
843 { 0xcf, "ACI Appliance Vector" },
844 { 0xd0, "ACI Node IP" },
845 { 0xd1, "ACI Port Role" },
846 { 0xd2, "ACI Firmware Version" },
847 { 0xd3, "ACI Infra VLAN" },
848 { 0xd4, "ACI Serial Number" },
849 { 0xd6, "ACI Model" },
850 { 0xd7, "ACI Node Name" },
851 { 0xd8, "ACI Port Mode" },
852 { 0xd9, "ACI Authentication Cookie" },
853 { 0xda, "ACI APIC-Mode" },
854 { 0xdb, "ACI Fabric ID" },
855 { 0, NULL }
858 static const true_false_string tfs_desired_not_desired = { "Desired", "Not Desired" };
860 static const value_string cisco_portstate_vals[] = {
861 { 1, "In Service" },
862 { 2, "Out of Service" },
863 { 0, NULL }
866 static const value_string cisco_portrole_vals[] = {
867 { 1, "Active" },
868 { 2, "Backup" },
869 { 0, NULL }
871 static const value_string cisco_portmode_vals[] = {
872 { 0, "Normal" },
873 { 1, "Recovery Mode" },
874 { 0, NULL }
877 /* Guessing here, the output of apic show commands only has leaf and spine, and
878 those values are leaf=2, spine=3 (off by 1) */
879 static const value_string cisco_noderole_vals[] = {
880 { 0, "APIC" },
881 { 1, "Leaf" },
882 { 2, "Spine" },
883 { 3, "vLeaf" },
884 { 0, NULL }
887 static const value_string cisco_apicmode_vals[] = {
888 { 0, "Active" },
889 { 1, "Standby" },
890 { 0, NULL }
893 /* Avaya Subtypes */
894 static const value_string avaya_subtypes[] = {
895 { 1, "PoE Conservation Level Support" },
896 { 3, "Call Server IP Address" },
897 { 4, "IP Phone Addresses" },
898 { 5, "CNA Server IP Address" },
899 { 6, "File Server" },
900 { 7, "802.1Q Framing" },
901 { 0, NULL }
904 /* Avaya 802.1Q Framing Subtypes */
905 static const value_string avaya_dot1q_subtypes[] = {
906 { 1, "Tagging" },
907 { 2, "No Tagging" },
908 { 0, NULL }
911 /* IANA Subtypes */
912 static const value_string iana_subtypes[] = {
913 { 1, "Manufacturer Usage Description URL" },
914 { 0, NULL }
919 /* 802.3 Power Class */
920 static const value_string power_class_802_3[] = {
921 { 1, "0" },
922 { 2, "1" },
923 { 3, "2" },
924 { 4, "3" },
925 { 5, "4" },
926 { 0, NULL }
929 /* 802.3bt Extended Power Class */
930 static const value_string power_class_ext_802_3_bt[] = {
931 { 1, "Class 1" },
932 { 2, "Class 2" },
933 { 3, "Class 3" },
934 { 4, "Class 4" },
935 { 5, "Class 5" },
936 { 6, "Class 6" },
937 { 7, "Class 7" },
938 { 8, "Class 8" },
939 { 15, "Dual signature" },
940 { 0, NULL }
943 /* 802.3 Power Pair */
944 static const value_string power_pair_802_3[] = {
945 { 1, "Signal" },
946 { 2, "Spare" },
947 { 0, NULL }
950 /* 802.3bt extended powering pairs */
951 static const value_string power_pairs_ext_802_3_bt[] = {
952 { 0, "Ignore" },
953 { 1, "Alternative A" },
954 { 2, "Alternative B" },
955 { 3, "Both alternatives" },
956 { 0, NULL }
959 /* 802.3 Power Type */
960 static const value_string power_type_802_3[] = {
961 { 0, "Type 2 PSE Device" },
962 { 1, "Type 2 PD Device" },
963 { 2, "Type 1 PSE Device" },
964 { 3, "Type 1 PD Device" },
965 { 0, NULL }
968 /* 802.3bt Extended Power Type */
969 static const value_string power_type_ext_802_3_bt[] = {
970 { 0, "Type 3 PSE Device" },
971 { 1, "Type 4 PSE Device" },
972 { 2, "Type 3 single-signature PD Device" },
973 { 3, "Type 3 dual-signature PD Device" },
974 { 4, "Type 4 single-signature PD Device" },
975 { 5, "Type 4 dual-signature PD Device" },
976 { 6, "Reserved/Ignore" },
977 { 7, "Reserved/Ignore" },
978 { 0, NULL }
981 /* 802.3bt Dual-signature Extended Power Class Mode A|B */
982 static const value_string power_type_ext_mode_ab_802_3_bt[] = {
983 { 0, "Reserved/Ignore" },
984 { 1, "Class 1" },
985 { 2, "Class 2" },
986 { 3, "Class 3" },
987 { 4, "Class 4" },
988 { 5, "Class 5" },
989 { 6, "Reserved/Ignore" },
990 { 7, "Single-signature or 2-pair PD" },
991 { 0, NULL }
994 /* 802.3bt extended PSE powering status */
995 static const value_string pse_powering_status_802_3_bt[] = {
996 { 0, "Ignore" },
997 { 1, "2-pair" },
998 { 2, "4-pair single-signature" },
999 { 3, "4-pair dual-signature" },
1000 { 0, NULL }
1003 /* 802.3bt extended PD powering status */
1004 static const value_string pd_powered_status_802_3_bt[] = {
1005 { 0, "Ignore" },
1006 { 1, "Single-signature PD" },
1007 { 2, "2-pair dual-signature PD" },
1008 { 3, "4-pair dual-signature PD" },
1009 { 0, NULL }
1012 static const true_false_string tfs_ieee_802_3_pse_pd = { "PSE", "PD" };
1013 static const true_false_string tfs_ieee_802_3_pd_load = { "Isolated", "Not isolated" };
1014 static const true_false_string tfs_unknown_defined = { "Unknown", "Defined" };
1016 /* Power Type */
1017 static const value_string media_power_type[] = {
1018 { 0, "PSE Device" },
1019 { 1, "PD Device" },
1020 { 2, "PSE Device" },
1021 { 3, "PD Device" },
1022 { 0, NULL }
1025 /* Power Priority */
1026 static const value_string media_power_priority[] = {
1027 { 0, "Unknown" },
1028 { 1, "Critical" },
1029 { 2, "High" },
1030 { 3, "Low" },
1031 { 0, NULL }
1034 /* Power Sources */
1035 static const value_string media_power_pd_device[] = {
1036 { 0, "Unknown" },
1037 { 1, "PSE" },
1038 { 2, "Local" },
1039 { 3, "PSE and Local" },
1040 { 0, NULL }
1042 static const value_string media_power_pse_device[] = {
1043 { 0, "Unknown" },
1044 { 1, "Primary Power Source" },
1045 { 2, "Backup Power Source" },
1046 { 0, NULL }
1049 /* Location data format */
1050 static const value_string location_data_format[] = {
1051 { 0, "Invalid " },
1052 { 1, "Coordinate-based LCI" },
1053 { 2, "Civic Address LCI" },
1054 { 3, "ECS ELIN" },
1055 { 0, NULL }
1058 /* Altitude Type */
1059 static const value_string altitude_type[] = {
1060 { 1, "Meters" },
1061 { 2, "Floors" },
1062 { 0, NULL }
1065 /* Datum Type */
1066 static const value_string datum_type_values[] = {
1067 { 1, "WGS84" },
1068 { 2, "NAD83 (Latitude, Longitude) + NAVD88" },
1069 { 3, "NAD83 (Latitude, Longitude) + MLLW" },
1070 { 0, NULL }
1073 /* Civic Address LCI - What field */
1074 static const value_string civic_address_what_values[] = {
1075 { 0, "Location of the DHCP server" },
1076 { 1, "Location of the network element believed to be closest to the client" },
1077 { 2, "Location of the client"},
1078 { 0, NULL}
1081 /* Civic Address Type field */
1082 static const value_string civic_address_type_values[] = {
1083 { 0, "Language" },
1084 { 1, "National subdivisions (province, state, etc)" },
1085 { 2, "County, parish, district" },
1086 { 3, "City, township" },
1087 { 4, "City division, borough, ward" },
1088 { 5, "Neighborhood, block" },
1089 { 6, "Street" },
1090 { 16, "Leading street direction" },
1091 { 17, "Trailing street suffix" },
1092 { 18, "Street suffix" },
1093 { 19, "House number" },
1094 { 20, "House number suffix" },
1095 { 21, "Landmark or vanity address" },
1096 { 22, "Additional location information" },
1097 { 23, "Name" },
1098 { 24, "Postal/ZIP code" },
1099 { 25, "Building" },
1100 { 26, "Unit" },
1101 { 27, "Floor" },
1102 { 28, "Room number" },
1103 { 29, "Place type" },
1104 { 128, "Script" },
1105 { 0, NULL }
1109 * Define the text strings for the LLDP 802.3 MAC/PHY Configuration/Status
1110 * Operational MAU Type field.
1112 * These values are taken from the DESCRIPTION field of the dot3MauType
1113 * objects defined in RFC 4836
1116 /* from rfc 4836 dot3MauType */
1117 static const value_string operational_mau_type_values[] = {
1118 { 0, "other or unknown" },
1119 /* rfc 1515 values */
1120 { 1, "AUI - no internal MAU, view from AUI" },
1121 { 2, "10Base5 - thick coax MAU" },
1122 { 3, "Foirl - FOIRL MAU" },
1123 { 4, "10Base2 - thin coax MAU" },
1124 { 5, "10BaseT - UTP MAU" },
1125 { 6, "10BaseFP - passive fiber MAU" },
1126 { 7, "10BaseFB - sync fiber MAU" },
1127 { 8, "10BaseFL - async fiber MAU" },
1128 { 9, "10Broad36 - broadband DTE MAU" },
1129 /* rfc 2239 updates */
1130 { 10, "10BaseTHD - UTP MAU, half duplex mode" },
1131 { 11, "10BaseTFD - UTP MAU, full duplex mode" },
1132 { 12, "10BaseFLHD - async fiber MAU, half duplex mode" },
1133 { 13, "10BaseFLDF - async fiber MAU, full duplex mode" },
1134 { 14, "10BaseT4 - 4 pair category 3 UTP" },
1135 { 15, "100BaseTXHD - 2 pair category 5 UTP, half duplex mode" },
1136 { 16, "100BaseTXFD - 2 pair category 5 UTP, full duplex mode" },
1137 { 17, "100BaseFXHD - X fiber over PMT, half duplex mode" },
1138 { 18, "100BaseFXFD - X fiber over PMT, full duplex mode" },
1139 { 19, "100BaseT2HD - 2 pair category 3 UTP, half duplex mode" },
1140 { 20, "100BaseT2DF - 2 pair category 3 UTP, full duplex mode" },
1141 /* rfc 2668 updates */
1142 { 21, "1000BaseXHD - PCS/PMA, unknown PMD, half duplex mode" },
1143 { 22, "1000BaseXFD - PCS/PMA, unknown PMD, full duplex mode" },
1144 { 23, "1000BaseLXHD - Fiber over long-wavelength laser, half duplex mode" },
1145 { 24, "1000BaseLXFD - Fiber over long-wavelength laser, full duplex mode" },
1146 { 25, "1000BaseSXHD - Fiber over short-wavelength laser, half duplex mode" },
1147 { 26, "1000BaseSXFD - Fiber over short-wavelength laser, full duplex mode" },
1148 { 27, "1000BaseCXHD - Copper over 150-Ohm balanced cable, half duplex mode" },
1149 { 28, "1000BaseCXFD - Copper over 150-Ohm balanced cable, full duplex mode" },
1150 { 29, "1000BaseTHD - Four-pair Category 5 UTP, half duplex mode" },
1151 { 30, "1000BaseTFD - Four-pair Category 5 UTP, full duplex mode" },
1152 /* rfc 3636 updates */
1153 { 31, "10GigBaseX - X PCS/PMA, unknown PMD." },
1154 { 32, "10GigBaseLX4 - X fiber over WWDM optics" },
1155 { 33, "10GigBaseR - R PCS/PMA, unknown PMD." },
1156 { 34, "10GigBaseER - R fiber over 1550 nm optics" },
1157 { 35, "10GigBaseLR - R fiber over 1310 nm optics" },
1158 { 36, "10GigBaseSR - R fiber over 850 nm optics" },
1159 { 37, "10GigBaseW - W PCS/PMA, unknown PMD." },
1160 { 38, "10GigBaseEW - W fiber over 1550 nm optics" },
1161 { 39, "10GigBaseLW - W fiber over 1310 nm optics" },
1162 { 40, "10GigBaseSW - W fiber over 850 nm optics" },
1163 /* rfc 4836 updates */
1164 { 41, "10GBASE-CX4 - X copper over 8 pair 100-Ohm balanced cable" },
1165 { 42, "2BASE-TL - Voice grade UTP copper, up to 2700m, optional PAF" },
1166 { 43, "10PASS-TS - Voice grade UTP copper, up to 750m, optional PAF" },
1167 { 44, "100BASE-BX10D - One single-mode fiber OLT, long wavelength, 10km" },
1168 { 45, "100BASE-BX10U - One single-mode fiber ONU, long wavelength, 10km" },
1169 { 46, "100BASE-LX10 - One single-mode fiber ONU, long wavelength, 10km" },
1170 { 47, "1000BASE-BX10D - One single-mode fiber OLT, long wavelength, 10km" },
1171 { 48, "1000BASE-BX10U - One single-mode fiber ONU, long wavelength, 10km" },
1172 { 49, "1000BASE-LX10 - Two single-mode fiber, long wavelength, 10km" },
1173 { 50, "1000BASE-PX10D - One single-mode fiber EPON OLT, 10km" },
1174 { 51, "1000BASE-PX10U - One single-mode fiber EPON ONU, 10km" },
1175 { 52, "1000BASE-PX20D - One single-mode fiber EPON OLT, 20km" },
1176 { 53, "1000BASE-PX20U - One single-mode fiber EPON ONU, 20km" },
1177 { 0, NULL }
1180 /* Hytec Masks */
1181 #define HYTEC_GROUP_MASK 0xE0
1182 #define HYTEC_GROUP_MASK_OFFSET 0
1183 #define HYTEC_GROUP_MASK_SIZE 3
1184 #define HYTEC_IDENTIFIER_MASK 0x1F
1185 #define HYTEC_IDENTIFIER_MASK_OFFSET HYTEC_GROUP_MASK_SIZE
1186 #define HYTEC_IDENTIFIER_MASK_SIZE 5
1188 /* Hytec Subtypes */
1189 #define HYTEC_SUBTYPE__TRANSCEIVER 1
1190 #define HYTEC_SUBTYPE__TRACE 2
1192 /* Hytec Transceiver Groups */
1193 #define HYTEC_TRANSG__TRANCEIVER_IDENTIFIER 1
1194 #define HYTEC_TRANSG__TRANSCEIVER_BRIDGEABLE_DISTANCE 2
1195 #define HYTEC_TRANSG__MEASUREMENT_DATA 3
1197 /* Hytec Trace Groups */
1198 #define HYTEC_TRACEG__MAC_TRACE 1
1200 /* Hytec Transceiver Identifiers */
1201 #define HYTEC_TID__VENDOR_PRODUCT_REVISION 1
1203 #define HYTEC_TID__VENDOR_PRODUCT_REVISION_STR "Transceiver vendor, product and revision"
1205 /* Hytec Transceiver Bridgeable Distance Values */
1206 #define HYTEC_TBD__SINGLE_MODE 1
1207 #define HYTEC_TBD__MULTI_MODE_50 2
1208 #define HYTEC_TBD__MULTI_MODE_62_5 3
1210 #define HYTEC_TBD__SINGLE_MODE_STR "Single mode (9/125 um)"
1211 #define HYTEC_TBD__MULTI_MODE_50_STR "Multi mode (50/125 um)"
1212 #define HYTEC_TBD__MULTI_MODE_62_5_STR "Multi mode (62.5/125 um)"
1215 /* Hytec Measurement Data Values */
1216 #define HYTEC_MD__TX_CURRENT_OUTPUT_POWER 1
1217 #define HYTEC_MD__RX_CURRENT_INPUT_POWER 2
1218 #define HYTEC_MD__RX_INPUT_SNR 3
1219 #define HYTEC_MD__LINELOSS 4
1221 #define HYTEC_MD__TX_CURRENT_OUTPUT_POWER_STR "Tx current output power"
1222 #define HYTEC_MD__RX_CURRENT_INPUT_POWER_STR "Rx current input power"
1223 #define HYTEC_MD__RX_INPUT_SNR_STR "Rx input SNR"
1224 #define HYTEC_MD__LINELOSS_STR "Lineloss"
1227 /* Hytec MAC Trace Values */
1228 #define HYTEC_MC__MAC_TRACE_REQUEST 1
1229 #define HYTEC_MC__MAC_TRACE_REPLY 2
1230 #define HYTEC_MC__NAME_OF_REPLYING_DEVICE 3
1231 #define HYTEC_MC__OUTGOING_PORT_NAME 4
1232 #define HYTEC_MC__IPV4_ADDRESS_OF_REPLYING_DEVICE 5
1233 #define HYTEC_MC__END_OF_TRACE 6
1234 #define HYTEC_MC__IPV6_ADDRESS_OF_REPLYING_DEVICE 7
1235 #define HYTEC_MC__INCOMING_PORT_NAME 8
1236 #define HYTEC_MC__TRACE_IDENTIFIER 9
1238 #define HYTEC_MC__MAC_TRACE_REQUEST_STR "MAC Trace Request"
1239 #define HYTEC_MC__MAC_TRACE_REPLY_STR "MAC Trace Reply"
1240 #define HYTEC_MC__NAME_OF_REPLYING_DEVICE_STR "Name of replying device"
1241 #define HYTEC_MC__OUTGOING_PORT_NAME_STR "Outgoing port name"
1242 #define HYTEC_MC__IPV4_ADDRESS_OF_REPLYING_DEVICE_STR "IPv4 address of replying device"
1243 #define HYTEC_MC__END_OF_TRACE_STR "End of Trace"
1244 #define HYTEC_MC__IPV6_ADDRESS_OF_REPLYING_DEVICE_STR "IPv6 address of replying device"
1245 #define HYTEC_MC__INCOMING_PORT_NAME_STR "Incoming port name"
1246 #define HYTEC_MC__TRACE_IDENTIFIER_STR "Trace identifier"
1249 static const value_string hytec_subtypes[] = {
1250 {HYTEC_SUBTYPE__TRANSCEIVER, "Transceiver"},
1251 {HYTEC_SUBTYPE__TRACE, "Trace"},
1252 {0, NULL}
1255 static const value_string hytec_transceiver_groups[] = {
1256 {HYTEC_TRANSG__TRANCEIVER_IDENTIFIER, "Transceiver identifier"},
1257 {HYTEC_TRANSG__TRANSCEIVER_BRIDGEABLE_DISTANCE, "Transceiver bridgeable distance"},
1258 {HYTEC_TRANSG__MEASUREMENT_DATA, "Measurement data"},
1259 {0, NULL}
1262 static const value_string hytec_trace_groups[] = {
1263 {HYTEC_TRACEG__MAC_TRACE, "MAC Trace"},
1264 {0, NULL}
1267 static const value_string hytec_tid[] = {
1268 {HYTEC_TID__VENDOR_PRODUCT_REVISION, HYTEC_TID__VENDOR_PRODUCT_REVISION_STR},
1269 {0, NULL}
1272 static const value_string hytec_tbd[] = {
1273 {HYTEC_TBD__SINGLE_MODE, HYTEC_TBD__SINGLE_MODE_STR},
1274 {HYTEC_TBD__MULTI_MODE_50, HYTEC_TBD__MULTI_MODE_50_STR},
1275 {HYTEC_TBD__MULTI_MODE_62_5, HYTEC_TBD__MULTI_MODE_62_5_STR},
1276 {0, NULL}
1279 static const value_string hytec_md[] = {
1280 {HYTEC_MD__TX_CURRENT_OUTPUT_POWER, HYTEC_MD__TX_CURRENT_OUTPUT_POWER_STR},
1281 {HYTEC_MD__RX_CURRENT_INPUT_POWER, HYTEC_MD__RX_CURRENT_INPUT_POWER_STR},
1282 {HYTEC_MD__RX_INPUT_SNR, HYTEC_MD__RX_INPUT_SNR_STR},
1283 {HYTEC_MD__LINELOSS, HYTEC_MD__LINELOSS_STR},
1284 {0, NULL}
1287 static const value_string hytec_mc[] = {
1288 {HYTEC_MC__MAC_TRACE_REQUEST, HYTEC_MC__MAC_TRACE_REQUEST_STR},
1289 {HYTEC_MC__MAC_TRACE_REPLY, HYTEC_MC__MAC_TRACE_REPLY_STR},
1290 {HYTEC_MC__NAME_OF_REPLYING_DEVICE, HYTEC_MC__NAME_OF_REPLYING_DEVICE_STR},
1291 {HYTEC_MC__OUTGOING_PORT_NAME, HYTEC_MC__OUTGOING_PORT_NAME_STR},
1292 {HYTEC_MC__IPV4_ADDRESS_OF_REPLYING_DEVICE, HYTEC_MC__IPV4_ADDRESS_OF_REPLYING_DEVICE_STR},
1293 {HYTEC_MC__END_OF_TRACE, HYTEC_MC__END_OF_TRACE_STR},
1294 {HYTEC_MC__IPV6_ADDRESS_OF_REPLYING_DEVICE, HYTEC_MC__IPV6_ADDRESS_OF_REPLYING_DEVICE_STR},
1295 {HYTEC_MC__INCOMING_PORT_NAME, HYTEC_MC__INCOMING_PORT_NAME_STR},
1296 {HYTEC_MC__TRACE_IDENTIFIER, HYTEC_MC__TRACE_IDENTIFIER_STR},
1297 {0, NULL}
1301 /* System Capabilities */
1302 #define SYSTEM_CAPABILITY_OTHER 0x0001
1303 #define SYSTEM_CAPABILITY_REPEATER 0x0002
1304 #define SYSTEM_CAPABILITY_BRIDGE 0x0004
1305 #define SYSTEM_CAPABILITY_WLAN 0x0008
1306 #define SYSTEM_CAPABILITY_ROUTER 0x0010
1307 #define SYSTEM_CAPABILITY_TELEPHONE 0x0020
1308 #define SYSTEM_CAPABILITY_DOCSIS 0x0040
1309 #define SYSTEM_CAPABILITY_STATION 0x0080
1310 #define SYSTEM_CAPABILITY_CVLAN 0x0100
1311 #define SYSTEM_CAPABILITY_SVLAN 0x0200
1312 #define SYSTEM_CAPABILITY_TPMR 0x0400
1314 /* Media Capabilities */
1315 #define MEDIA_CAPABILITY_LLDP 0x0001
1316 #define MEDIA_CAPABILITY_NETWORK_POLICY 0x0002
1317 #define MEDIA_CAPABILITY_LOCATION_ID 0x0004
1318 #define MEDIA_CAPABILITY_MDI_PSE 0x0008
1319 #define MEDIA_CAPABILITY_MDI_PD 0x0010
1320 #define MEDIA_CAPABILITY_INVENTORY 0x0020
1323 * Define constants for the LLDP 802.3 MAC/PHY Configuration/Status
1324 * PMD Auto-Negotiation Advertised Capability field.
1325 * These values are taken from the ifMauAutoNegCapAdvertisedBits
1326 * object defined in RFC 3636.
1329 #define AUTONEG_OTHER 0x8000 /* bOther(0), -- other or unknown */
1330 #define AUTONEG_10BASE_T 0x4000 /* b10baseT(1), -- 10BASE-T half duplex mode */
1331 #define AUTONEG_10BASET_FD 0x2000 /* b10baseTFD(2), -- 10BASE-T full duplex mode */
1332 #define AUTONEG_100BASE_T4 0x1000 /* b100baseT4(3), -- 100BASE-T4 */
1333 #define AUTONEG_100BASE_TX 0x0800 /* b100baseTX(4), -- 100BASE-TX half duplex mode */
1334 #define AUTONEG_100BASE_TXFD 0x0400 /* b100baseTXFD(5), -- 100BASE-TX full duplex mode */
1335 #define AUTONEG_100BASE_T2 0x0200 /* b100baseT2(6), -- 100BASE-T2 half duplex mode */
1336 #define AUTONEG_100BASE_T2FD 0x0100 /* b100baseT2FD(7), -- 100BASE-T2 full duplex mode */
1337 #define AUTONEG_FDX_PAUSE 0x0080 /* bFdxPause(8), -- PAUSE for full-duplex links */
1338 #define AUTONEG_FDX_APAUSE 0x0040 /* bFdxAPause(9), -- Asymmetric PAUSE for full-duplex links */
1339 #define AUTONEG_FDX_SPAUSE 0x0020 /* bFdxSPause(10), -- Symmetric PAUSE for full-duplex links */
1340 #define AUTONEG_FDX_BPAUSE 0x0010 /* bFdxBPause(11), -- Asymmetric and Symmetric PAUSE for full-duplex links */
1341 #define AUTONEG_1000BASE_X 0x0008 /* b1000baseX(12), -- 1000BASE-X, -LX, -SX, -CX half duplex mode */
1342 #define AUTONEG_1000BASE_XFD 0x0004 /* b1000baseXFD(13), -- 1000BASE-X, -LX, -SX, -CX full duplex mode */
1343 #define AUTONEG_1000BASE_T 0x0002 /* b1000baseT(14), -- 1000BASE-T half duplex mode */
1344 #define AUTONEG_1000BASE_TFD 0x0001 /* b1000baseTFD(15) -- 1000BASE-T full duplex mode */
1346 /* Some vendors interpreted the standard to invert the bitorder:
1347 * according to a IEEE ruling, this is now officially wrong.
1348 * See https://gitlab.com/wireshark/wireshark/-/issues/1455
1349 * for all the gory details
1352 #define INV_AUTONEG_OTHER 0x0001 /* bOther(0), -- other or unknown */
1353 #define INV_AUTONEG_10BASE_T 0x0002 /* b10baseT(1), -- 10BASE-T half duplex mode */
1354 #define INV_AUTONEG_10BASET_FD 0x0004 /* b10baseTFD(2), -- 10BASE-T full duplex mode */
1355 #define INV_AUTONEG_100BASE_T4 0x0008 /* b100baseT4(3), -- 100BASE-T4 */
1356 #define INV_AUTONEG_100BASE_TX 0x0010 /* b100baseTX(4), -- 100BASE-TX half duplex mode */
1357 #define INV_AUTONEG_100BASE_TXFD 0x0020 /* b100baseTXFD(5), -- 100BASE-TX full duplex mode */
1358 #define INV_AUTONEG_100BASE_T2 0x0040 /* b100baseT2(6), -- 100BASE-T2 half duplex mode */
1359 #define INV_AUTONEG_100BASE_T2FD 0x0080 /* b100baseT2FD(7), -- 100BASE-T2 full duplex mode */
1360 #define INV_AUTONEG_FDX_PAUSE 0x0100 /* bFdxPause(8), -- PAUSE for full-duplex links */
1361 #define INV_AUTONEG_FDX_APAUSE 0x0200 /* bFdxAPause(9), -- Asymmetric PAUSE for full-duplex links */
1362 #define INV_AUTONEG_FDX_SPAUSE 0x0400 /* bFdxSPause(10), -- Symmetric PAUSE for full-duplex links */
1363 #define INV_AUTONEG_FDX_BPAUSE 0x0800 /* bFdxBPause(11), -- Asymmetric and Symmetric PAUSE for full-duplex links */
1364 #define INV_AUTONEG_1000BASE_X 0x1000 /* b1000baseX(12), -- 1000BASE-X, -LX, -SX, -CX half duplex mode */
1365 #define INV_AUTONEG_1000BASE_XFD 0x2000 /* b1000baseXFD(13), -- 1000BASE-X, -LX, -SX, -CX full duplex mode */
1366 #define INV_AUTONEG_1000BASE_T 0x4000 /* b1000baseT(14), -- 1000BASE-T half duplex mode */
1367 #define INV_AUTONEG_1000BASE_TFD 0x8000 /* b1000baseTFD(15) -- 1000BASE-T full duplex mode */
1369 #define EVB_CAPA_STD 0x8000
1370 #define EVB_CAPA_RR 0x4000
1372 #define EVB_CAPA_RTE 0x0004
1373 #define EVB_CAPA_ECP 0x0002
1374 #define EVB_CAPA_VDP 0x0001
1376 /* IEEE 802.3br Additional Ethernet Capabilities flags */
1377 #define IEEE_802_3BR_AEC_SUPPORT 0x0001
1378 #define IEEE_802_3BR_AEC_ENABLE 0x0002
1379 #define IEEE_802_3BR_AEC_ACTIVE 0x0004
1380 #define IEEE_802_3BR_AEC_ADDFRAGSIZE 0x0018
1381 #define IEEE_802_3BR_AEC_RESERVED 0xFFE0
1383 #define MAX_MAC_LEN 6
1386 static const value_string profinet_port2_status_vals[] = {
1387 { 0, "OFF" },
1388 { 1, "SYNCDATA_LOADED" },
1389 { 2, "RTCLASS2_UP" },
1390 { 3, "Reserved" },
1391 /* all other bits reserved */
1392 { 0, NULL }
1395 static const value_string profinet_port3_status_vals[] = {
1396 { 0, "OFF" },
1397 { 1, "reserved" },
1398 { 2, "RTCLASS3_UP" },
1399 { 3, "RTCLASS3_DOWN" },
1400 { 4, "RTCLASS3_RUN" },
1401 /* all other bits reserved */
1402 { 0, NULL }
1405 static const value_string profinet_port3_status_PreambleLength[] = {
1406 { 0, "Seven octets" },
1407 { 1, "One octet" },
1408 { 0, NULL }
1410 static const value_string profinet_mrrt_port_status_vals[] = {
1411 { 0, "OFF" },
1412 { 1, "MRRT_CONFIGURED" },
1413 { 2, "MRRT_UP" },
1414 /* all other bits reserved */
1415 { 0, NULL }
1417 static const value_string profinet_time_domain_number_vals[] = {
1418 { 0x0000, "Global Time" },
1419 { 0x0001, "Global Time Redundant" },
1420 { 0x0020, "Working Clock" },
1421 { 0x0021, "Working Clock Redundant" },
1422 { 0, NULL }
1425 /* IEEE 802.1Qbg Subtypes */
1426 static const value_string ieee_802_1qbg_subtypes[] = {
1427 { 0x00, "EVB" },
1428 { 0x01, "CDCP" },
1429 { 0x02, "VDP" },
1430 { 0, NULL }
1433 static void
1434 mdi_power_base(char *buf, uint32_t value) {
1435 snprintf(buf, ITEM_LABEL_LENGTH, "%u.%u. Watt", value/10, value%10);
1438 static void
1439 media_power_base(char *buf, uint32_t value) {
1440 snprintf(buf, ITEM_LABEL_LENGTH, "%u mW", value * 100);
1443 // Get absolute 2's complement value
1444 // Returns true if the value is negative (so if
1445 // it returns false, there is no conversion).
1446 // bitSize: number of bits of the variable.
1447 static bool
1448 get2sComplementAbsoluteValue(uint64_t * value, unsigned bitSize){
1449 const uint64_t signMask = INT64_C(0x1) << (bitSize - 1);
1451 uint64_t signedMask = INT64_C(0x1) << bitSize;
1452 signedMask--;
1453 signedMask = ~signedMask;
1455 if(*value & signMask){
1456 *value |= signedMask; // sign propagation
1458 // Convert to absolute value
1459 *value = ~(*value);
1460 (*value)++;
1461 return true;
1463 return false;
1466 static uint64_t
1467 getUint64MaskedValue(uint64_t value, unsigned bitSize){
1468 uint64_t mask = INT64_C(0x1) << bitSize;
1469 mask--;
1470 return value & mask;
1473 static uint64_t
1474 pow10_uint64(int exponent){
1475 uint64_t val = 1;
1477 while(exponent > 0){
1478 val *= 10;
1479 exponent--;
1482 while(exponent < 0){
1483 val /= 10;
1484 exponent++;
1486 return val;
1489 // Decode uint fractional variable
1490 static uint64_t
1491 convertFractionalToFixedSizeDecimal(uint64_t value, unsigned fractionalBitSize, unsigned numberOfDigitToDisplay){
1492 const uint64_t resolution = INT64_C(0x1) << fractionalBitSize;
1493 // => 0x02000000 for 25-bits
1494 // => 0x00000100 for 8-bits
1496 const uint64_t fractionalPortionMask = resolution - 1;
1497 value &= fractionalPortionMask;
1499 // Maximum value for numberOfDigitToDisplay is :
1500 // log10(INT64_C(0xFFFFFFFFFFFFFFFF) / fractionalPortionMask);
1501 // => if result is stored in 32-bits, numberOfDigitToDisplay max = 9
1502 const uint64_t displayMultiplier = pow10_uint64(numberOfDigitToDisplay);
1503 value *= displayMultiplier;
1504 uint64_t moduloValue = value % resolution;
1505 value /= resolution;
1506 if(moduloValue >= (resolution/2)){
1507 value++; // rounded value
1510 return value;
1514 /* Calculate Latitude and Longitude string */
1516 Parameters:
1517 option = 0 -> Latitude
1518 option = 1 -> Longitude
1520 static void
1521 get_latitude_or_longitude(char *buf, int option, uint64_t unmasked_value)
1523 /* The latitude and longitude are 34 bit fixed point value consisting
1524 of 9 bits of integer and 25 bits of fraction.
1525 When option is equal to 0, positive numbers are represent a location
1526 north of the equator and negative (2s complement) numbers are south of the equator.
1527 When option is equal to 1, positive values are east of the prime
1528 meridian and negative (2s complement) numbers are west of the prime meridian.
1529 Longitude values outside the range of -180 to 180 decimal degrees or latitude values
1530 outside the range of -90 to 90 degrees MUST be considered invalid.
1532 const unsigned variableBitSize = 34;
1533 const unsigned fractionalBitSize = 25;
1534 const uint64_t maxlatitude = (INT64_C(0x1) << fractionalBitSize) * INT64_C(90); // 90 degrees
1535 const uint64_t maxlongitude = (INT64_C(0x1) << fractionalBitSize) * INT64_C(180); // 180 degrees
1537 uint64_t masked_value = getUint64MaskedValue(unmasked_value, variableBitSize); // get 34-bit value
1539 // Get absolute value of a 34-bit 2's variable
1540 // => value is 33-bit
1541 uint64_t absolute_value = masked_value;
1542 bool isNegative = get2sComplementAbsoluteValue(&absolute_value, variableBitSize);
1544 // Get unsigned integer 8-bit value
1545 uint32_t integerPortion = (uint32_t)(absolute_value >> fractionalBitSize);
1547 // Get fractional 25-bit value
1548 const unsigned numberOfDigitToDisplay = 4;
1549 uint64_t fixedSizeDecimal = convertFractionalToFixedSizeDecimal(absolute_value, fractionalBitSize, numberOfDigitToDisplay);
1551 const char *direction;
1552 const char *err_str = "";
1553 if (option == 0){
1554 // Latitude - north/south directions
1555 if (isNegative){
1556 direction = "South";
1557 } else {
1558 direction = "North";
1560 if(absolute_value > maxlatitude){
1561 err_str = "[Error: value > 90 degrees] ";
1563 } else {
1564 // Longitude - east/west directions
1565 if (isNegative){
1566 direction = "West";
1567 } else {
1568 direction = "East";
1570 if(absolute_value > maxlongitude){
1571 err_str = "[Error: value > 180 degrees] ";
1575 const uint64_t fractionalMask = (INT64_C(0x1) << fractionalBitSize) - 1;
1577 // %04 correspond to numberOfDigitToDisplay
1578 snprintf(buf, ITEM_LABEL_LENGTH, "%s%u.%04" PRIu64 " degrees %s (0x%010" PRIX64 " - %u-bit integer part 0x%04" PRIX64 " / %u-bit fractional part 0x%08" PRIX64 ")",
1579 err_str,
1580 integerPortion, fixedSizeDecimal, direction, masked_value,
1581 variableBitSize - fractionalBitSize, masked_value >> fractionalBitSize,
1582 fractionalBitSize, masked_value & fractionalMask
1586 static void
1587 latitude_base(char *buf, uint64_t value) {
1588 get_latitude_or_longitude(buf, 0, value);
1591 static void
1592 longitude_base(char *buf, uint64_t value) {
1593 get_latitude_or_longitude(buf, 1, value);
1596 static void
1597 altitude_base(char *buf, uint32_t unmasked_value) {
1598 // RFC6225
1599 // Altitude: A 30-bit value defined by the AType field.
1600 // In some cases, the altitude of the location might not be provided.
1601 // An Altitude Type value of zero indicates that the altitude is not
1602 // given to the client. In this case, the Altitude and Altitude
1603 // Uncertainty fields can contain any value and MUST be ignored.
1605 // If the Altitude Type has a value of one, altitude is measured in
1606 // meters, in relation to the zero set by the vertical datum. For AType
1607 // = 1, the altitude value is expressed as a 30-bit, fixed-point, two's
1608 // complement integer with 22 integer bits and 8 fractional bits.
1610 // A value of two for Altitude Type indicates that the altitude value is
1611 // measured in floors. Since altitude in meters may not be known within
1612 // a building, a floor indication may be more useful. For AType = 2,
1613 // the altitude value is expressed as a 30-bit, fixed-point, two's
1614 // complement integer with 22 integer bits and 8 fractional bits.
1616 // the altitude resolution (AltRes) value encodes the number of
1617 // high-order altitude bits that should be considered valid.
1618 // Values above 30 (decimal) are undefined and reserved.
1620 const unsigned variableBitSize = 30;
1621 const unsigned fractionalBitSize = 8;
1623 uint64_t masked_value = getUint64MaskedValue(unmasked_value, variableBitSize); // get 30-bit value
1625 // Get absolute value of a 30-bit 2's variable
1626 // => value is 29-bit
1627 uint64_t absolute_value = masked_value;
1628 bool isNegative = get2sComplementAbsoluteValue(&absolute_value, variableBitSize);
1630 // Get unsigned integer 8-bit value
1631 uint32_t integerPortion = (uint32_t)(absolute_value >> fractionalBitSize);
1633 // Get fractional 8-bit value
1634 const unsigned numberOfDigitToDisplay = 4;
1635 uint64_t fixedSizeDecimal = convertFractionalToFixedSizeDecimal(absolute_value, fractionalBitSize, numberOfDigitToDisplay);
1637 const char * sign;
1638 if (isNegative){
1639 sign = "-";
1640 } else {
1641 sign = "+";
1645 const uint64_t fractionalMask = (INT64_C(0x1) << fractionalBitSize) - 1;
1647 // %04 correspond to numberOfDigitToDisplay
1648 snprintf(buf, ITEM_LABEL_LENGTH, "%s%u.%04" PRIu64 " (0x%08" PRIX64 " - %u-bit integer part 0x%06" PRIX64 " / %u-bit fractional part 0x%02" PRIX64 ")",
1649 sign, integerPortion, fixedSizeDecimal, masked_value,
1650 variableBitSize - fractionalBitSize, masked_value >> fractionalBitSize,
1651 fractionalBitSize, masked_value & fractionalMask
1655 static void
1656 latitude_or_longitude_resolution(char *buf, uint8_t value) {
1657 // formula, where x is the encoded integer value:
1658 // Uncertainty = 2 ^ ( 8 - x )
1660 int32_t masked_value = value & 0x3F;
1661 double resolution = 1.0;
1662 int32_t i = 8 - masked_value;
1663 while(i > 0){
1664 resolution *= 2.0;
1665 i--;
1667 while(i < 0){
1668 resolution /= 2.0;
1669 i++;
1672 const char *err_str = "";
1673 if(masked_value > 34){
1674 err_str = "[Error: value > 34] ";
1675 } else if(masked_value < 2){
1676 err_str = "[Warning: value < 2] ";
1679 snprintf(buf, ITEM_LABEL_LENGTH, "%s%lE degrees (%" PRIi32 ")", err_str, resolution, masked_value);
1682 static void
1683 altitude_resolution(char *buf, uint8_t value) {
1684 // The encoded altitude of 000000000000000010000110110011 decodes to
1685 // 33.69921875. The encoded uncertainty of 15 gives a value of 64;
1686 // therefore, the final uncertainty is 33.69921875 +/- 64 (or the range
1687 // from -30.30078125 to 97.69921875).
1688 // The amount of altitude uncertainty can be determined by the following
1689 // formula, where x is the encoded integer value:
1690 // Uncertainty = 2 ^ ( 21 - x )
1691 // = 2 ^ ( 21 - 15 ) = 2 ^ 6 = 64
1693 int32_t masked_value = value & 0x3F;
1694 double resolution = 1.0;
1695 int32_t i = 21 - masked_value;
1696 while(i > 0){
1697 resolution *= 2.0;
1698 i--;
1700 while(i < 0){
1701 resolution /= 2.0;
1702 i++;
1705 const char *err_str = "";
1706 if(masked_value > 30){
1707 err_str = "[Error: value > 34] ";
1708 } else if(masked_value < 2){
1709 err_str = "[Warning: value < 2] ";
1712 snprintf(buf, ITEM_LABEL_LENGTH, "%s%lf (%" PRIi32 ")", err_str, resolution, masked_value);
1716 /* Dissect Chassis Id TLV (Mandatory) */
1717 static int32_t
1718 dissect_lldp_chassis_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint32_t offset,
1719 profinet_lldp_column_info *pn_lldp_column_info)
1721 uint8_t tlvsubType;
1722 uint16_t tempShort;
1723 uint32_t dataLen = 0;
1724 const char *strPtr=NULL;
1725 const char *idType=NULL;
1726 uint8_t addr_family = 0;
1728 proto_tree *chassis_tree = NULL;
1729 proto_item *tf = NULL, *lf = NULL;
1731 /* Get tlv type */
1732 tempShort = tvb_get_ntohs(tvb, offset);
1733 tlvsubType = TLV_TYPE(tempShort);
1734 if (tlvsubType != CHASSIS_ID_TLV_TYPE)
1736 proto_tree_add_expert_format(tree, pinfo, &ei_lldp_bad_type , tvb, offset, TLV_INFO_LEN(tempShort),
1737 "Invalid TLV type (0x%02X), expected ChassisID type (0x%02X)", tlvsubType, CHASSIS_ID_TLV_TYPE);
1739 return -1;
1742 /* Get tlv length */
1743 dataLen = TLV_INFO_LEN(tempShort);
1744 /* Get tlv subtype */
1745 tlvsubType = tvb_get_uint8(tvb, (offset+2));
1747 /* Set chassis tree */
1748 chassis_tree = proto_tree_add_subtree_format(tree, tvb, offset, (dataLen + 2), ett_chassis_id, &tf, "Chassis Subtype = %s",
1749 val_to_str_const(tlvsubType, chassis_id_subtypes, "Reserved" ));
1751 proto_tree_add_item(chassis_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN);
1752 lf = proto_tree_add_item(chassis_tree, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN);
1754 offset += 2;
1756 if (dataLen < 2)
1758 expert_add_info_format(pinfo, lf, &ei_lldp_bad_length,
1759 "Invalid Chassis ID Length (%u), expected > (2)", dataLen);
1761 return -1;
1764 /* Get chassis id subtype */
1765 proto_tree_add_item(chassis_tree, hf_chassis_id_subtype, tvb, offset, 1, ENC_BIG_ENDIAN);
1767 offset++;
1769 switch (tlvsubType)
1771 case 4: /* MAC address */
1773 if (dataLen != 7)
1775 expert_add_info_format(pinfo, lf, &ei_lldp_bad_length,
1776 "Invalid Chassis ID Length (%u) for Type (%s), expected (7)", dataLen, val_to_str_const(tlvsubType, chassis_id_subtypes, ""));
1777 return -1;
1780 idType="MA";
1781 strPtr = tvb_ether_to_str(pinfo->pool, tvb, offset);
1782 proto_tree_add_item(chassis_tree, hf_chassis_id_mac, tvb, offset, 6, ENC_NA);
1783 pn_lldp_column_info->chassis_id_mac = wmem_strdup(pinfo->pool, strPtr);
1784 offset += (dataLen - 1);
1785 break;
1787 case 5: /* Network address */
1789 /* Get network address family */
1790 proto_tree_add_item(chassis_tree, hf_lldp_network_address_family, tvb, offset, 1, ENC_BIG_ENDIAN);
1791 addr_family = tvb_get_uint8(tvb,offset);
1793 offset++;
1795 idType="NA";
1797 /* Check for IPv4 or IPv6 */
1798 switch(addr_family){
1799 case AFNUM_INET:
1800 if (dataLen == 6){
1801 strPtr = tvb_ip_to_str(pinfo->pool, tvb, offset);
1802 }else{
1803 expert_add_info_format(pinfo, lf, &ei_lldp_bad_length,
1804 "Invalid Chassis ID Length (%u) for Type (%s, %s), expected (6)", dataLen, val_to_str_const(tlvsubType, chassis_id_subtypes, ""), val_to_str_const(addr_family, afn_vals, ""));
1805 return -1;
1808 proto_tree_add_item(chassis_tree, hf_chassis_id_ip4, tvb, offset, 4, ENC_BIG_ENDIAN);
1810 break;
1811 case AFNUM_INET6:
1812 if (dataLen == 18){
1813 strPtr = tvb_ip6_to_str(pinfo->pool, tvb, offset);
1814 }else{
1815 expert_add_info_format(pinfo, lf, &ei_lldp_bad_length,
1816 "Invalid Chassis ID Length (%u) for Type (%s, %s), expected (18)", dataLen, val_to_str_const(tlvsubType, chassis_id_subtypes, ""), val_to_str_const(addr_family, afn_vals, ""));
1817 return -1;
1820 proto_tree_add_item(chassis_tree, hf_chassis_id_ip6, tvb, offset, 16, ENC_NA);
1822 break;
1823 default:
1824 strPtr = tvb_bytes_to_str(pinfo->pool, tvb, offset, (dataLen-2));
1825 proto_tree_add_item(chassis_tree, hf_chassis_id, tvb, offset, (dataLen-2), ENC_NA);
1827 break;
1830 offset += (dataLen - 2);
1831 break;
1833 case 1: /* Chassis component */
1834 case 2: /* Interface alias */
1835 case 3: /* Port component */
1836 case 6: /* Interface name */
1837 case 7: /* Locally assigned */
1838 default:
1840 if (dataLen > 256)
1842 expert_add_info_format(pinfo, lf, &ei_lldp_bad_length_excess,
1843 "Invalid Chassis ID Length (%u) for Type (%s), expected < (256)", dataLen, val_to_str_const(tlvsubType, chassis_id_subtypes, ""));
1844 return -1;
1847 switch(tlvsubType)
1849 case 2: /* Interface alias */
1850 idType="IA";
1851 strPtr = tvb_format_stringzpad(pinfo->pool, tvb, offset, (dataLen - 1));
1852 break;
1853 case 6: /* Interface name */
1854 idType="IN";
1855 strPtr = tvb_format_stringzpad(pinfo->pool, tvb, offset, (dataLen - 1));
1856 break;
1857 case 7: /* Locally assigned */
1858 idType="LA";
1859 strPtr = tvb_format_stringzpad(pinfo->pool, tvb, offset, (dataLen-1));
1860 pn_lldp_column_info->chassis_id_locally_assigned = wmem_strdup(pinfo->pool, strPtr);
1861 break;
1862 case 1: /* Chassis component */
1863 idType="CC";
1864 strPtr = tvb_format_stringzpad(pinfo->pool, tvb, offset, (dataLen - 1));
1865 break;
1866 case 3: /* Port component */
1867 idType="PC";
1868 strPtr = tvb_bytes_to_str(pinfo->pool, tvb, offset, (dataLen-1));
1870 break;
1871 default:
1872 idType="Rs";
1873 strPtr = "Reserved";
1875 break;
1878 proto_tree_add_item(chassis_tree, hf_chassis_id, tvb, offset, (dataLen-1), ENC_NA);
1880 offset += (dataLen - 1);
1881 break;
1885 if (column_info_selection == DEFAULT_COLUMN_INFO)
1887 col_append_fstr(pinfo->cinfo, COL_INFO, "%s/%s ", idType, strPtr);
1889 proto_item_append_text(tf, ", Id: %s", strPtr);
1891 return offset;
1894 /* Dissect Port Id TLV (Mandatory) */
1895 static int32_t
1896 dissect_lldp_port_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint32_t offset,
1897 profinet_lldp_column_info *pn_lldp_column_info)
1899 uint8_t tlvsubType;
1900 uint16_t tempShort;
1901 uint32_t dataLen = 0;
1902 const char *strPtr=NULL;
1903 const char *idType=NULL;
1904 uint8_t addr_family = 0;
1906 proto_tree *port_tree = NULL;
1907 proto_item *tf = NULL, *lf = NULL;
1909 /* Get tlv type */
1910 tempShort = tvb_get_ntohs(tvb, offset);
1911 tlvsubType = TLV_TYPE(tempShort);
1912 if (tlvsubType != PORT_ID_TLV_TYPE)
1914 proto_tree_add_expert_format(tree, pinfo, &ei_lldp_bad_type , tvb, offset, TLV_INFO_LEN(tempShort),
1915 "Invalid Port ID (0x%02X), expected (0x%02X)", tlvsubType, PORT_ID_TLV_TYPE);
1917 return -1;
1920 /* Get tlv length and subtype */
1921 dataLen = TLV_INFO_LEN(tempShort);
1922 tlvsubType = tvb_get_uint8(tvb, (offset+2));
1924 /* Set port tree */
1925 port_tree = proto_tree_add_subtree_format(tree, tvb, offset, (dataLen + 2), ett_port_id, &tf, "Port Subtype = %s",
1926 val_to_str_const(tlvsubType, port_id_subtypes, "Unknown" ));
1928 proto_tree_add_item(port_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN);
1929 lf = proto_tree_add_item(port_tree, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN);
1931 offset += 2;
1933 if (dataLen < 2) {
1934 expert_add_info_format(pinfo, lf, &ei_lldp_bad_length,
1935 "Invalid Port ID Length (%u), expected > (2)", dataLen);
1937 return -1;
1940 /* Get port id subtype */
1941 proto_tree_add_item(port_tree, hf_port_id_subtype, tvb, offset, 1, ENC_BIG_ENDIAN);
1943 offset++;
1945 switch (tlvsubType)
1947 case 3: /* MAC address */
1948 if (dataLen != 7)
1950 expert_add_info_format(pinfo, lf, &ei_lldp_bad_length,
1951 "Invalid Port ID Length (%u) for Type (%s), expected (7)", dataLen, val_to_str_const(tlvsubType, port_id_subtypes, ""));
1952 return -1;
1955 idType = "MA";
1956 strPtr = tvb_ether_to_str(pinfo->pool, tvb, offset);
1957 proto_tree_add_item(port_tree, hf_port_id_mac, tvb, offset, 6, ENC_NA);
1959 offset += (dataLen - 1);
1960 break;
1961 case 4: /* Network address */
1962 /* Get network address family */
1963 addr_family = tvb_get_uint8(tvb,offset);
1964 proto_tree_add_item(port_tree, hf_lldp_network_address_family, tvb, offset, 1, ENC_BIG_ENDIAN);
1966 offset++;
1968 idType = "NA";
1970 /* Check for IPv4 or IPv6 */
1971 switch(addr_family){
1972 case AFNUM_INET:
1973 if (dataLen == 6){
1974 strPtr = tvb_ip_to_str(pinfo->pool, tvb, offset);
1975 }else{
1976 expert_add_info_format(pinfo, lf, &ei_lldp_bad_length,
1977 "Invalid Port ID Length (%u) for Type (%s, %s), expected (6)", dataLen, val_to_str_const(tlvsubType, port_id_subtypes, ""), val_to_str_const(addr_family, afn_vals, ""));
1978 return -1;
1981 proto_tree_add_item(port_tree, hf_port_id_ip4, tvb, offset, 4, ENC_BIG_ENDIAN);
1983 break;
1984 case AFNUM_INET6:
1985 if (dataLen == 18){
1986 strPtr = tvb_ip6_to_str(pinfo->pool, tvb, offset);
1987 }else{
1988 expert_add_info_format(pinfo, lf, &ei_lldp_bad_length,
1989 "Invalid Port ID Length (%u) for Type (%s, %s), expected (18)", dataLen, val_to_str_const(tlvsubType, port_id_subtypes, ""), val_to_str_const(addr_family, afn_vals, ""));
1990 return -1;
1993 proto_tree_add_item(port_tree, hf_port_id_ip6, tvb, offset, 16, ENC_NA);
1995 break;
1996 default:
1997 strPtr = tvb_bytes_to_str(pinfo->pool, tvb, offset, (dataLen-2));
1998 proto_tree_add_item(port_tree, hf_port_id, tvb, offset, (dataLen-2), ENC_ASCII);
2000 break;
2003 offset += (dataLen - 2);
2004 break;
2005 case 1: /* Interface alias */
2006 case 2: /* Port Component */
2007 case 5: /* Interface name */
2008 case 6: /* Agent circuit ID */
2009 case 7: /* Locally assigned */
2010 default:
2011 if (dataLen > 256)
2013 expert_add_info_format(pinfo, lf, &ei_lldp_bad_length_excess,
2014 "Invalid Port ID Length (%u) for Type (%s), expected < (256)", dataLen, val_to_str_const(tlvsubType, port_id_subtypes, ""));
2015 return -1;
2018 switch (tlvsubType)
2020 case 1: /* Interface alias */
2021 idType = "IA";
2022 strPtr = tvb_format_stringzpad(pinfo->pool, tvb, offset, (dataLen - 1));
2023 break;
2024 case 2: /* Port component */
2025 idType = "PC";
2026 strPtr = tvb_bytes_to_str(pinfo->pool, tvb, offset, (dataLen-1));
2027 break;
2028 case 5: /* Interface name */
2029 idType = "IN";
2030 strPtr = tvb_format_stringzpad(pinfo->pool, tvb, offset, (dataLen - 1));
2031 break;
2032 case 6: /* Agent circuit ID */
2033 idType = "AC";
2034 strPtr = tvb_format_stringzpad(pinfo->pool, tvb, offset, (dataLen - 1));
2035 break;
2036 case 7: /* Locally assigned */
2037 idType = "LA";
2038 strPtr = tvb_format_stringzpad(pinfo->pool, tvb, offset, (dataLen-1));
2039 pn_lldp_column_info->port_id_locally_assigned = wmem_strdup(pinfo->pool, strPtr);
2040 break;
2041 default:
2042 idType = "Rs";
2043 strPtr = "Reserved";
2044 break;
2047 proto_tree_add_item(port_tree, hf_port_id, tvb, offset, (dataLen-1), ENC_ASCII);
2049 offset += (dataLen - 1);
2050 break;
2052 if (column_info_selection == DEFAULT_COLUMN_INFO)
2054 col_append_fstr(pinfo->cinfo, COL_INFO, "%s/%s ", idType, strPtr);
2056 proto_item_append_text(tf, ", Id: %s", strPtr);
2058 return offset;
2061 /* Dissect Time To Live TLV (Mandatory) */
2062 static int32_t
2063 dissect_lldp_time_to_live(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint32_t offset, uint16_t *isShutdown)
2065 uint8_t tlvsubType;
2066 uint16_t tempShort;
2067 uint32_t dataLen = 0;
2069 proto_tree *time_to_live_tree;
2070 proto_item *ti;
2072 /* Get tlv type */
2073 tempShort = tvb_get_ntohs(tvb, offset);
2074 tlvsubType = TLV_TYPE(tempShort);
2075 if (tlvsubType != TIME_TO_LIVE_TLV_TYPE)
2076 return -1;
2078 /* Get tlv length and seconds field */
2079 dataLen = TLV_INFO_LEN(tempShort);
2080 tempShort = tvb_get_ntohs(tvb, (offset+2));
2081 *isShutdown = !tempShort;
2083 /* LLDPDU types: IEEE 802.1AB-2016 9.1.2 */
2084 if (tempShort != 0) {
2085 time_to_live_tree = proto_tree_add_subtree_format(tree, tvb, offset, dataLen + 2,
2086 ett_time_to_live, NULL, "Time To Live = %u sec", tempShort);
2087 ti = proto_tree_add_none_format(time_to_live_tree, hf_pdu_type, tvb, offset, dataLen + 2, "Normal LLDPDU");
2088 proto_item_set_generated(ti);
2089 } else {
2090 time_to_live_tree = proto_tree_add_subtree_format(tree, tvb, offset, dataLen + 2,
2091 ett_time_to_live, NULL, "Discard all info for this MSAP (Time To Live = 0)");
2092 ti = proto_tree_add_none_format(time_to_live_tree, hf_pdu_type, tvb, offset, dataLen + 2, "Shutdown LLDPDU");
2093 proto_item_set_generated(ti);
2096 proto_tree_add_item(time_to_live_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN);
2097 proto_tree_add_item(time_to_live_tree, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN);
2098 offset += 2;
2100 /* Display time to live information */
2101 proto_tree_add_item(time_to_live_tree, hf_time_to_live, tvb, offset, 2, ENC_BIG_ENDIAN);
2102 offset += 2;
2104 if (column_info_selection == DEFAULT_COLUMN_INFO) {
2105 if (tempShort != 0) {
2106 col_append_fstr(pinfo->cinfo, COL_INFO, "%u ", tempShort);
2107 } else {
2108 col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", "0 (Shutdown LLDPDU)");
2112 return offset;
2115 /* Dissect End of LLDPDU TLV */
2116 /* As of 802.1ab-2016 LLDP is defective by design. The End of LLDPDU was changed from its
2117 * previously mandatory state to optional. With nothing to indicate the length of the entire LLDPDU
2118 * and no marker to indicate the end of the LLDPDU there are now cases where it is not possible to
2119 * affirmatively determine that an LLDPDU has ended. Depending on where a capture is collected,
2120 * additional data may follow the LLDPDU (FCS, diagnostic trailers, non-zero padding, etc...)
2122 static int32_t
2123 dissect_lldp_end_of_lldpdu(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, uint32_t offset)
2125 uint8_t tlvType;
2126 uint16_t dataLen;
2127 uint16_t tempShort;
2129 proto_tree *end_of_lldpdu_tree, *lf;
2131 /* Get tlv type and length */
2132 tempShort = tvb_get_ntohs(tvb, offset);
2133 tlvType = TLV_TYPE(tempShort);
2135 /* Get tlv length */
2136 dataLen = TLV_INFO_LEN(tempShort);
2138 /* Set port tree */
2139 end_of_lldpdu_tree = proto_tree_add_subtree(tree, tvb, offset, (dataLen + 2), ett_end_of_lldpdu, NULL, "End of LLDPDU");
2141 proto_tree_add_item(end_of_lldpdu_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN);
2142 lf = proto_tree_add_item(end_of_lldpdu_tree, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN);
2143 if (dataLen > 0)
2145 /* Either a corrupt / bad End of LLDPDU, or the start of something after an LLDPDU
2146 * without an End of LLDPDU TLV.
2147 * Add EI pointing out possible invalid End of LLDP, but do not consume bytes.
2148 * Any trailer, FCS, etc starting with 0x00 or 0x01 would be interpreted as an
2149 * End of LLDPDU. Chances are better that they belong to another dissector vs.
2150 * being a malformed End of LLDPDU (or other TLV).
2152 * It may be reasonable to add pref to consume the bytes anyway
2155 expert_add_info_format(pinfo, lf, &ei_lldp_bad_length_excess,
2156 "Invalid Length (%u) for Type (%s), expected (0)", dataLen, val_to_str_const(tlvType, tlv_types, ""));
2157 return -1;
2160 offset += 2;
2161 return offset;
2164 /* Dissect Port Description TLV */
2165 static int32_t
2166 dissect_lldp_port_desc(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, uint32_t offset)
2168 uint16_t tempShort;
2169 uint32_t dataLen = 0;
2170 const char *strPtr;
2172 proto_tree *port_desc_tree;
2174 /* Get tlv type and length */
2175 tempShort = tvb_get_ntohs(tvb, offset);
2177 /* Get tlv length */
2178 dataLen = TLV_INFO_LEN(tempShort);
2180 strPtr = tvb_format_stringzpad(pinfo->pool, tvb, (offset+2), dataLen);
2182 /* Set port tree */
2183 port_desc_tree = proto_tree_add_subtree_format(tree, tvb, offset, (dataLen + 2),
2184 ett_port_description, NULL, "Port Description = %s", strPtr);
2186 proto_tree_add_item(port_desc_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN);
2187 proto_tree_add_item(port_desc_tree, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN);
2189 offset += 2;
2190 /* Display port description information */
2191 proto_tree_add_item(port_desc_tree, hf_port_desc, tvb, offset, dataLen, ENC_ASCII);
2193 offset += dataLen;
2195 return offset;
2198 /* Dissect System Name and description TLV */
2199 static int32_t
2200 dissect_lldp_system_name(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, uint32_t offset)
2202 uint16_t tempShort;
2203 uint32_t dataLen = 0;
2204 uint8_t tlvsubType;
2205 const char *strPtr;
2207 proto_tree *system_subtree;
2209 /* Get tlv type and length */
2210 tempShort = tvb_get_ntohs(tvb, offset);
2211 tlvsubType = TLV_TYPE(tempShort);
2213 /* Get tlv length */
2214 dataLen = TLV_INFO_LEN(tempShort);
2216 strPtr = tvb_format_stringzpad(pinfo->pool, tvb, (offset+2), dataLen);
2218 /* Set system name tree */
2219 if (tlvsubType == SYSTEM_NAME_TLV_TYPE) {
2220 system_subtree = proto_tree_add_subtree_format(tree, tvb, offset, (dataLen + 2),
2221 ett_system_name, NULL, "System Name = %s", strPtr);
2222 if (column_info_selection == DEFAULT_COLUMN_INFO)
2224 col_append_fstr(pinfo->cinfo, COL_INFO, "SysN=%s ", strPtr);
2226 } else {
2227 system_subtree = proto_tree_add_subtree_format(tree, tvb, offset, (dataLen + 2),
2228 ett_system_desc, NULL, "System Description = %s", strPtr);
2229 if (column_info_selection == DEFAULT_COLUMN_INFO)
2231 col_append_fstr(pinfo->cinfo, COL_INFO, "SysD=%s ", strPtr);
2235 proto_tree_add_item(system_subtree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN);
2236 proto_tree_add_item(system_subtree, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN);
2238 offset +=2;
2240 /* Display system name information */
2241 if (tlvsubType == SYSTEM_NAME_TLV_TYPE)
2242 proto_tree_add_item(system_subtree, hf_lldp_tlv_system_name, tvb, offset, dataLen, ENC_ASCII);
2243 else
2244 proto_tree_add_item(system_subtree, hf_lldp_tlv_system_desc, tvb, offset, dataLen, ENC_ASCII);
2246 offset += dataLen;
2248 return offset;
2251 /* Dissect System Capabilities TLV */
2252 static int32_t
2253 dissect_lldp_system_capabilities(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, uint32_t offset)
2255 uint16_t tempShort;
2256 uint32_t dataLen = 0;
2258 proto_tree *system_capabilities_tree;
2259 proto_tree *capabilities_summary_tree;
2260 proto_tree *capabilities_enabled_tree;
2261 proto_item *tf;
2263 /* Get tlv type and length */
2264 tempShort = tvb_get_ntohs(tvb, offset);
2266 /* Get tlv length */
2267 dataLen = TLV_INFO_LEN(tempShort);
2269 /* Set system capabilities tree */
2270 system_capabilities_tree = proto_tree_add_subtree(tree, tvb, offset, (dataLen + 2), ett_system_cap, NULL, "Capabilities");
2272 proto_tree_add_item(system_capabilities_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN);
2273 proto_tree_add_item(system_capabilities_tree, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN);
2275 offset += 2;
2276 /* Display system capability information */
2277 tf = proto_tree_add_item(system_capabilities_tree, hf_lldp_tlv_system_cap, tvb, offset, 2, ENC_BIG_ENDIAN);
2278 capabilities_summary_tree = proto_item_add_subtree(tf, ett_system_cap_summary);
2280 /* Add capabilities to summary tree */
2281 proto_tree_add_item(capabilities_summary_tree, hf_lldp_tlv_system_cap_other, tvb, offset, 2, ENC_BIG_ENDIAN);
2282 proto_tree_add_item(capabilities_summary_tree, hf_lldp_tlv_system_cap_repeater, tvb, offset, 2, ENC_BIG_ENDIAN);
2283 proto_tree_add_item(capabilities_summary_tree, hf_lldp_tlv_system_cap_bridge, tvb, offset, 2, ENC_BIG_ENDIAN);
2284 proto_tree_add_item(capabilities_summary_tree, hf_lldp_tlv_system_cap_wlan_access_pt, tvb, offset, 2, ENC_BIG_ENDIAN);
2285 proto_tree_add_item(capabilities_summary_tree, hf_lldp_tlv_system_cap_router, tvb, offset, 2, ENC_BIG_ENDIAN);
2286 proto_tree_add_item(capabilities_summary_tree, hf_lldp_tlv_system_cap_telephone, tvb, offset, 2, ENC_BIG_ENDIAN);
2287 proto_tree_add_item(capabilities_summary_tree, hf_lldp_tlv_system_cap_docsis_cable_device, tvb, offset, 2, ENC_BIG_ENDIAN);
2288 proto_tree_add_item(capabilities_summary_tree, hf_lldp_tlv_system_cap_station_only, tvb, offset, 2, ENC_BIG_ENDIAN);
2289 proto_tree_add_item(capabilities_summary_tree, hf_lldp_tlv_system_cap_cvlan_component, tvb, offset, 2, ENC_BIG_ENDIAN);
2290 proto_tree_add_item(capabilities_summary_tree, hf_lldp_tlv_system_cap_svlan_component, tvb, offset, 2, ENC_BIG_ENDIAN);
2291 proto_tree_add_item(capabilities_summary_tree, hf_lldp_tlv_system_cap_tpmr_component, tvb, offset, 2, ENC_BIG_ENDIAN);
2293 offset += 2;
2294 /* Get enabled summary */
2296 /* Display system capability information */
2297 tf = proto_tree_add_item(system_capabilities_tree, hf_lldp_tlv_enable_system_cap, tvb, offset, 2, ENC_BIG_ENDIAN);
2298 capabilities_enabled_tree = proto_item_add_subtree(tf, ett_system_cap_enabled);
2299 proto_tree_add_item(capabilities_enabled_tree, hf_lldp_tlv_enable_system_cap_other, tvb, offset, 2, ENC_BIG_ENDIAN);
2300 proto_tree_add_item(capabilities_enabled_tree, hf_lldp_tlv_enable_system_cap_repeater, tvb, offset, 2, ENC_BIG_ENDIAN);
2301 proto_tree_add_item(capabilities_enabled_tree, hf_lldp_tlv_enable_system_cap_bridge, tvb, offset, 2, ENC_BIG_ENDIAN);
2302 proto_tree_add_item(capabilities_enabled_tree, hf_lldp_tlv_enable_system_cap_wlan_access_pt, tvb, offset, 2, ENC_BIG_ENDIAN);
2303 proto_tree_add_item(capabilities_enabled_tree, hf_lldp_tlv_enable_system_cap_router, tvb, offset, 2, ENC_BIG_ENDIAN);
2304 proto_tree_add_item(capabilities_enabled_tree, hf_lldp_tlv_enable_system_cap_telephone, tvb, offset, 2, ENC_BIG_ENDIAN);
2305 proto_tree_add_item(capabilities_enabled_tree, hf_lldp_tlv_enable_system_cap_docsis_cable_device, tvb, offset, 2, ENC_BIG_ENDIAN);
2306 proto_tree_add_item(capabilities_enabled_tree, hf_lldp_tlv_enable_system_cap_station_only, tvb, offset, 2, ENC_BIG_ENDIAN);
2307 proto_tree_add_item(capabilities_enabled_tree, hf_lldp_tlv_enable_system_cap_cvlan_component, tvb, offset, 2, ENC_BIG_ENDIAN);
2308 proto_tree_add_item(capabilities_enabled_tree, hf_lldp_tlv_enable_system_cap_svlan_component, tvb, offset, 2, ENC_BIG_ENDIAN);
2309 proto_tree_add_item(capabilities_enabled_tree, hf_lldp_tlv_enable_system_cap_tpmr_component, tvb, offset, 2, ENC_BIG_ENDIAN);
2311 offset += 2;
2313 return offset;
2316 /* Dissect Management Address TLV */
2317 static int32_t
2318 dissect_lldp_management_address(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, uint32_t offset)
2320 uint16_t tempShort;
2321 uint32_t dataLen = 0;
2322 uint8_t subtypeByte;
2323 uint8_t stringLen = 0;
2325 proto_tree *system_mgm_addr;
2327 /* Get tlv type and length */
2328 tempShort = tvb_get_ntohs(tvb, offset);
2330 /* Get tlv length */
2331 dataLen = TLV_INFO_LEN(tempShort);
2333 /* Set system capabilities tree */
2334 system_mgm_addr = proto_tree_add_subtree(tree, tvb, offset, (dataLen + 2), ett_management_address, NULL, "Management Address");
2336 proto_tree_add_item(system_mgm_addr, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN);
2337 proto_tree_add_item(system_mgm_addr, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN);
2339 offset += 2;
2341 /* Get management address string length */
2342 stringLen = tvb_get_uint8(tvb, offset);
2343 proto_tree_add_item(system_mgm_addr, hf_mgn_address_len, tvb, offset, 1, ENC_BIG_ENDIAN);
2345 offset++;
2347 /* Get management address subtype */
2348 subtypeByte = tvb_get_uint8(tvb, offset);
2349 proto_tree_add_item(system_mgm_addr, hf_mgn_address_subtype, tvb, offset, 1, ENC_BIG_ENDIAN);
2351 offset++;
2353 /* Get address */
2354 switch (subtypeByte)
2356 /* XXX - Should we throw an exception if stringLen doesn't match our address length? */
2357 case 1: /* IPv4 */
2358 proto_tree_add_item(system_mgm_addr, hf_mgn_addr_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
2359 break;
2360 case 2: /* IPv6 */
2361 proto_tree_add_item(system_mgm_addr, hf_mgn_addr_ipv6, tvb, offset, 16, ENC_NA);
2362 break;
2363 default:
2364 proto_tree_add_item(system_mgm_addr, hf_mgn_addr_hex, tvb, offset, (stringLen-1), ENC_NA);
2365 break;
2368 offset += (stringLen-1);
2370 /* Get interface numbering subtype */
2371 proto_tree_add_item(system_mgm_addr, hf_mgn_interface_subtype, tvb, offset, 1, ENC_BIG_ENDIAN);
2373 offset++;
2375 /* Get interface number */
2376 proto_tree_add_item(system_mgm_addr, hf_mgn_interface_number, tvb, offset, 4, ENC_BIG_ENDIAN);
2378 offset += 4;
2380 /* Get OID string length */
2381 stringLen = tvb_get_uint8(tvb, offset);
2382 proto_tree_add_item(system_mgm_addr, hf_mgn_oid_len, tvb, offset, 1, ENC_BIG_ENDIAN);
2384 offset++;
2386 if (stringLen > 0)
2388 /* Get OID identifier */
2389 proto_tree_add_item(system_mgm_addr, hf_mgn_obj_id, tvb, offset, stringLen, ENC_NA);
2391 offset += stringLen;
2394 return offset;
2397 /* Dissect DCBX TLVs */
2398 static void
2399 dissect_dcbx_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
2401 uint8_t subType;
2402 uint32_t offset = 0;
2403 uint8_t priomaskByte, prioCounter, appCount = 0;
2404 uint16_t dataLen;
2405 uint16_t tempShort;
2407 proto_tree *subtlv_tree = NULL;
2408 proto_tree *apptlv_tree = NULL;
2410 proto_tree_add_item(tree, hf_dcbx_type, tvb, offset, 1, ENC_BIG_ENDIAN);
2412 offset++;
2414 /* One org specific OUI holds many DCBx TLVs */
2415 while (tvb_reported_length_remaining(tvb, offset) && tree) {
2417 tempShort = tvb_get_ntohs(tvb, offset);
2419 /* Get TLV type & len. Actual TLV len = len + 2 */
2420 subType = TLV_TYPE(tempShort);
2421 dataLen = TLV_INFO_LEN(tempShort);
2423 /* Write out common header fields first */
2424 switch (subType)
2426 case 0x1: /* Control */
2427 subtlv_tree = proto_tree_add_subtree_format(tree, tvb, offset, dataLen + 2,
2428 ett_org_spc_dcbx_cee_1, NULL, "%s TLV", val_to_str_const(subType, dcbx_subtypes, "Unknown"));
2429 break;
2430 case 0x2: /* Priority Groups */
2431 subtlv_tree = proto_tree_add_subtree_format(tree, tvb, offset, dataLen + 2,
2432 ett_org_spc_dcbx_cee_2, NULL, "%s TLV", val_to_str_const(subType, dcbx_subtypes, "Unknown"));
2433 break;
2434 case 0x3: /* PFC */
2435 subtlv_tree = proto_tree_add_subtree_format(tree, tvb, offset, dataLen + 2,
2436 ett_org_spc_dcbx_cee_3, NULL, "%s TLV", val_to_str_const(subType, dcbx_subtypes, "Unknown"));
2437 break;
2438 case 0x4: /* Application */
2439 subtlv_tree = proto_tree_add_subtree_format(tree, tvb, offset, dataLen + 2,
2440 ett_org_spc_dcbx_cee_4, NULL, "%s TLV", val_to_str_const(subType, dcbx_subtypes, "Unknown"));
2441 break;
2442 case 0x6: /* Logical Link Down */
2443 subtlv_tree = proto_tree_add_subtree_format(tree, tvb, offset, dataLen + 2,
2444 ett_org_spc_dcbx_cin_6, NULL, "%s TLV", val_to_str_const(subType, dcbx_subtypes, "Unknown"));
2445 break;
2447 proto_tree_add_item(subtlv_tree, hf_dcbx_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN);
2448 proto_tree_add_item(subtlv_tree, hf_dcbx_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN);
2450 offset +=2;
2452 proto_tree_add_item(subtlv_tree, hf_dcbx_tlv_oper_version, tvb, offset, 1, ENC_BIG_ENDIAN);
2454 offset++;
2456 proto_tree_add_item(subtlv_tree, hf_dcbx_tlv_max_version, tvb, offset, 1, ENC_BIG_ENDIAN);
2458 offset++;
2460 if (subType == 0x1) {
2461 /* Specific to Control TLV */
2462 proto_tree_add_item(subtlv_tree, hf_dcbx_control_sequence, tvb, offset, 4, ENC_BIG_ENDIAN);
2464 offset +=4;
2466 proto_tree_add_item(subtlv_tree, hf_dcbx_control_ack, tvb, offset, 4, ENC_BIG_ENDIAN);
2468 offset +=4;
2469 } else {
2470 /* Common to all feature TLVs */
2471 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_flag_enabled, tvb, offset, 1, ENC_BIG_ENDIAN);
2472 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_flag_willing, tvb, offset, 1, ENC_BIG_ENDIAN);
2473 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_flag_error, tvb, offset, 1, ENC_BIG_ENDIAN);
2475 offset++;
2477 /* Unused field, no connection to SubType used to identify TLVs */
2478 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_subtype, tvb, offset, 1, ENC_BIG_ENDIAN);
2480 offset++;
2482 switch(subType)
2484 case 0x2: /* Priority Groups */
2486 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_pgid_prio_0, tvb, offset, 2, ENC_BIG_ENDIAN);
2487 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_pgid_prio_1, tvb, offset, 2, ENC_BIG_ENDIAN);
2488 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_pgid_prio_2, tvb, offset, 2, ENC_BIG_ENDIAN);
2489 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_pgid_prio_3, tvb, offset, 2, ENC_BIG_ENDIAN);
2491 offset +=2;
2493 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_pgid_prio_4, tvb, offset, 2, ENC_BIG_ENDIAN);
2494 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_pgid_prio_5, tvb, offset, 2, ENC_BIG_ENDIAN);
2495 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_pgid_prio_6, tvb, offset, 2, ENC_BIG_ENDIAN);
2496 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_pgid_prio_7, tvb, offset, 2, ENC_BIG_ENDIAN);
2498 offset +=2;
2500 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_pg_per_0, tvb, offset, 1, ENC_BIG_ENDIAN);
2502 offset++;
2504 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_pg_per_1, tvb, offset, 1, ENC_BIG_ENDIAN);
2506 offset++;
2508 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_pg_per_2, tvb, offset, 1, ENC_BIG_ENDIAN);
2510 offset++;
2512 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_pg_per_3, tvb, offset, 1, ENC_BIG_ENDIAN);
2514 offset++;
2516 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_pg_per_4, tvb, offset, 1, ENC_BIG_ENDIAN);
2518 offset++;
2520 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_pg_per_5, tvb, offset, 1, ENC_BIG_ENDIAN);
2522 offset++;
2524 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_pg_per_6, tvb, offset, 1, ENC_BIG_ENDIAN);
2526 offset++;
2528 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_pg_per_7, tvb, offset, 1, ENC_BIG_ENDIAN);
2530 offset++;
2532 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_pg_numtcs, tvb, offset, 1, ENC_BIG_ENDIAN);
2534 offset++;
2536 break;
2538 case 0x3: /* PFC */
2540 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_pfc_prio0, tvb, offset, 1, ENC_BIG_ENDIAN);
2541 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_pfc_prio1, tvb, offset, 1, ENC_BIG_ENDIAN);
2542 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_pfc_prio2, tvb, offset, 1, ENC_BIG_ENDIAN);
2543 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_pfc_prio3, tvb, offset, 1, ENC_BIG_ENDIAN);
2544 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_pfc_prio4, tvb, offset, 1, ENC_BIG_ENDIAN);
2545 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_pfc_prio5, tvb, offset, 1, ENC_BIG_ENDIAN);
2546 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_pfc_prio6, tvb, offset, 1, ENC_BIG_ENDIAN);
2547 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_pfc_prio7, tvb, offset, 1, ENC_BIG_ENDIAN);
2549 offset++;
2551 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_pfc_numtcs, tvb, offset, 1, ENC_BIG_ENDIAN);
2553 offset++;
2555 break;
2557 case 0x4: /* Application */
2559 /* One App TLV can hold 4 byte header & multiple apps, each app takes 6 bytes */
2560 appCount = (dataLen - 4)/6;
2562 while(appCount--) {
2563 tempShort = tvb_get_ntohs(tvb, offset);
2565 apptlv_tree = proto_tree_add_subtree_format(subtlv_tree, tvb, offset, 6,
2566 ett_org_spc_dcbx_cee_app, NULL, "%s Application",
2567 val_to_str_const(tempShort, dcbx_app_types, "Unknown"));
2569 proto_tree_add_item(apptlv_tree, hf_dcbx_feature_app_proto, tvb, offset, 2, ENC_BIG_ENDIAN);
2571 offset += 2;
2573 proto_tree_add_item(apptlv_tree, hf_dcbx_feature_app_oui, tvb, offset, 3, ENC_BIG_ENDIAN);
2574 proto_tree_add_item(apptlv_tree, hf_dcbx_feature_app_selector, tvb, offset, 3, ENC_BIG_ENDIAN);
2576 offset += 3;
2578 priomaskByte = tvb_get_uint8(tvb, offset);
2580 for (prioCounter = 0; prioCounter < 8; prioCounter++)
2581 if(priomaskByte & (0x1 << prioCounter)) {
2582 proto_tree_add_uint(apptlv_tree, hf_dcbx_feature_app_prio, tvb, offset, 1, prioCounter);
2583 break;
2586 offset++;
2588 break;
2590 case 0x6: /* Logical Link Down */
2592 proto_tree_add_item(subtlv_tree, hf_dcbx_feature_flag_llink_type, tvb, offset, 1, ENC_BIG_ENDIAN);
2594 offset++;
2596 break;
2603 return;
2606 /* Dissect IEEE 802.1 TLVs */
2607 static int
2608 dissect_ieee_802_1_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
2610 uint8_t subType;
2611 uint32_t offset = 0;
2612 uint8_t tempByte;
2613 uint16_t dcbApp, appCount;
2615 proto_tree *vlan_flags_tree = NULL;
2616 proto_tree *mac_phy_flags = NULL;
2617 proto_tree *apptlv_tree = NULL;
2618 proto_item *tf = NULL;
2620 /* Get subtype */
2621 subType = tvb_get_uint8(tvb, offset);
2623 proto_tree_add_item(tree, hf_ieee_802_1_subtype, tvb, offset, 1, ENC_BIG_ENDIAN);
2625 offset++;
2627 switch (subType)
2629 case 0x01: /* Port VLAN ID */
2631 proto_tree_add_item(tree, hf_ieee_802_1_port_vlan_id, tvb, offset, 2, ENC_BIG_ENDIAN);
2633 offset +=2;
2635 break;
2637 case 0x02: /* Port and Protocol VLAN ID */
2639 /* Get flags */
2640 tf = proto_tree_add_item(tree, hf_ieee_802_1_port_and_vlan_id_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
2641 vlan_flags_tree = proto_item_add_subtree(tf, ett_port_vlan_flags);
2643 proto_tree_add_item(vlan_flags_tree, hf_ieee_802_1_port_and_vlan_id_flag_supported, tvb, offset, 1, ENC_BIG_ENDIAN);
2644 proto_tree_add_item(vlan_flags_tree, hf_ieee_802_1_port_and_vlan_id_flag_enabled, tvb, offset, 1, ENC_BIG_ENDIAN);
2646 offset++;
2648 proto_tree_add_item(tree, hf_ieee_802_1_port_proto_vlan_id, tvb, offset, 2, ENC_BIG_ENDIAN);
2650 offset +=2;
2652 break;
2654 case 0x03: /* VLAN Name */
2656 proto_tree_add_item(tree, hf_ieee_802_1_vlan_id, tvb, offset, 2, ENC_BIG_ENDIAN);
2658 offset += 2;
2660 /* Get vlan name length */
2661 tempByte = tvb_get_uint8(tvb, offset);
2662 proto_tree_add_item(tree, hf_ieee_802_1_vlan_name_length, tvb, offset, 1, ENC_BIG_ENDIAN);
2664 offset++;
2666 if (tempByte > 0)
2668 proto_tree_add_item(tree, hf_ieee_802_1_vlan_name, tvb, offset, tempByte, ENC_ASCII);
2670 offset += tempByte;
2673 break;
2675 case 0x04: /* Protocol ID */
2677 /* Get protocol id length */
2678 tempByte = tvb_get_uint8(tvb, offset);
2679 proto_tree_add_item(tree, hf_ieee_802_1_proto_id_length, tvb, offset, 1, ENC_BIG_ENDIAN);
2681 offset++;
2683 if (tempByte > 0)
2686 * Section D.2.4.3 "protocol identity" of IEEE
2687 * 802.1Q-2018 says:
2689 * The protocol identity field shall contain
2690 * the first n octets of the protocol after
2691 * the layer 2 addresses (i.e., for example,
2692 * starting with the EtherType field) that the
2693 * sender would like to advertise.
2695 * What comes "after the layer 2 addresses"
2696 * depends on the network type. For Ethernet,
2697 * it's a type/length field, with, if it's a
2698 * length field, an 802.2 LLC header, with,
2699 * if that header specifies SNAP, a SNAP header
2700 * following it. For other network types, it's
2701 * just going to be an 802.2 LLC header (presumably,
2702 * if the layer 2 addresses aren't immediately
2703 * before the 802.2 header, this doesn't include
2704 * the fields between the last layer 2 address
2705 * and the 802.2 header).
2707 * We currently just show it as a blob of bytes.
2709 proto_tree_add_item(tree, hf_ieee_802_1_proto_id, tvb, offset, tempByte, ENC_NA);
2711 offset += tempByte;
2714 break;
2716 case 0x07: /* Link Aggregation */
2718 /* Get protocol id length */
2719 tf = proto_tree_add_item(tree, hf_ieee_802_1_aggregation_status, tvb, offset, 1, ENC_BIG_ENDIAN);
2720 mac_phy_flags = proto_item_add_subtree(tf, ett_802_1_aggregation);
2721 proto_tree_add_item(mac_phy_flags, hf_ieee_802_1_aggregation_status_cap, tvb, offset, 1, ENC_BIG_ENDIAN);
2722 proto_tree_add_item(mac_phy_flags, hf_ieee_802_1_aggregation_status_enabled, tvb, offset, 1, ENC_BIG_ENDIAN);
2723 proto_tree_add_item(mac_phy_flags, hf_ieee_802_1_aggregation_status_porttype, tvb, offset, 1, ENC_BIG_ENDIAN);
2725 offset++;
2727 /* Get aggregated port id */
2728 proto_tree_add_item(tree, hf_ieee_802_1_aggregated_port_id, tvb, offset, 4, ENC_BIG_ENDIAN);
2730 offset+=4;
2731 break;
2733 case 0x8: /* Congestion Notification */
2735 /* Per-Priority CNPV Indicators */
2736 proto_tree_add_item(tree, hf_ieee_8021qau_cnpv_prio0, tvb, offset, 1, ENC_BIG_ENDIAN);
2737 proto_tree_add_item(tree, hf_ieee_8021qau_cnpv_prio1, tvb, offset, 1, ENC_BIG_ENDIAN);
2738 proto_tree_add_item(tree, hf_ieee_8021qau_cnpv_prio2, tvb, offset, 1, ENC_BIG_ENDIAN);
2739 proto_tree_add_item(tree, hf_ieee_8021qau_cnpv_prio3, tvb, offset, 1, ENC_BIG_ENDIAN);
2740 proto_tree_add_item(tree, hf_ieee_8021qau_cnpv_prio4, tvb, offset, 1, ENC_BIG_ENDIAN);
2741 proto_tree_add_item(tree, hf_ieee_8021qau_cnpv_prio5, tvb, offset, 1, ENC_BIG_ENDIAN);
2742 proto_tree_add_item(tree, hf_ieee_8021qau_cnpv_prio6, tvb, offset, 1, ENC_BIG_ENDIAN);
2743 proto_tree_add_item(tree, hf_ieee_8021qau_cnpv_prio7, tvb, offset, 1, ENC_BIG_ENDIAN);
2745 offset++;
2747 /* Per-Priority Ready Indicators */
2748 proto_tree_add_item(tree, hf_ieee_8021qau_ready_prio0, tvb, offset, 1, ENC_BIG_ENDIAN);
2749 proto_tree_add_item(tree, hf_ieee_8021qau_ready_prio1, tvb, offset, 1, ENC_BIG_ENDIAN);
2750 proto_tree_add_item(tree, hf_ieee_8021qau_ready_prio2, tvb, offset, 1, ENC_BIG_ENDIAN);
2751 proto_tree_add_item(tree, hf_ieee_8021qau_ready_prio3, tvb, offset, 1, ENC_BIG_ENDIAN);
2752 proto_tree_add_item(tree, hf_ieee_8021qau_ready_prio4, tvb, offset, 1, ENC_BIG_ENDIAN);
2753 proto_tree_add_item(tree, hf_ieee_8021qau_ready_prio5, tvb, offset, 1, ENC_BIG_ENDIAN);
2754 proto_tree_add_item(tree, hf_ieee_8021qau_ready_prio6, tvb, offset, 1, ENC_BIG_ENDIAN);
2755 proto_tree_add_item(tree, hf_ieee_8021qau_ready_prio7, tvb, offset, 1, ENC_BIG_ENDIAN);
2757 offset++;
2759 break;
2761 case 0x9: /* ETS Configuration */
2763 proto_tree_add_item(tree, hf_ieee_8021az_feature_flag_willing, tvb, offset, 1, ENC_BIG_ENDIAN);
2764 proto_tree_add_item(tree, hf_ieee_8021az_feature_flag_cbs, tvb, offset, 1, ENC_BIG_ENDIAN);
2766 tempByte = (tvb_get_uint8(tvb, offset) & 0x7);
2767 /* 0 implies 8 traffic classes supported */
2768 proto_tree_add_uint_format_value(tree, hf_ieee_8021az_maxtcs, tvb, offset, 1, tempByte, "%u (0x%X)", tempByte ? tempByte : 8, tempByte);
2770 offset++;
2772 /* Priority Assignment Table */
2773 proto_tree_add_item(tree, hf_dcbx_feature_pgid_prio_0, tvb, offset, 2, ENC_BIG_ENDIAN);
2774 proto_tree_add_item(tree, hf_dcbx_feature_pgid_prio_1, tvb, offset, 2, ENC_BIG_ENDIAN);
2775 proto_tree_add_item(tree, hf_dcbx_feature_pgid_prio_2, tvb, offset, 2, ENC_BIG_ENDIAN);
2776 proto_tree_add_item(tree, hf_dcbx_feature_pgid_prio_3, tvb, offset, 2, ENC_BIG_ENDIAN);
2778 offset +=2;
2780 proto_tree_add_item(tree, hf_dcbx_feature_pgid_prio_4, tvb, offset, 2, ENC_BIG_ENDIAN);
2781 proto_tree_add_item(tree, hf_dcbx_feature_pgid_prio_5, tvb, offset, 2, ENC_BIG_ENDIAN);
2782 proto_tree_add_item(tree, hf_dcbx_feature_pgid_prio_6, tvb, offset, 2, ENC_BIG_ENDIAN);
2783 proto_tree_add_item(tree, hf_dcbx_feature_pgid_prio_7, tvb, offset, 2, ENC_BIG_ENDIAN);
2785 offset +=2;
2787 /* TC Bandwidth Table */
2788 proto_tree_add_item(tree, hf_dcbx_feature_pg_per_0, tvb, offset, 1, ENC_BIG_ENDIAN);
2790 offset++;
2792 proto_tree_add_item(tree, hf_dcbx_feature_pg_per_1, tvb, offset, 1, ENC_BIG_ENDIAN);
2794 offset++;
2796 proto_tree_add_item(tree, hf_dcbx_feature_pg_per_2, tvb, offset, 1, ENC_BIG_ENDIAN);
2798 offset++;
2800 proto_tree_add_item(tree, hf_dcbx_feature_pg_per_3, tvb, offset, 1, ENC_BIG_ENDIAN);
2802 offset++;
2804 proto_tree_add_item(tree, hf_dcbx_feature_pg_per_4, tvb, offset, 1, ENC_BIG_ENDIAN);
2806 offset++;
2808 proto_tree_add_item(tree, hf_dcbx_feature_pg_per_5, tvb, offset, 1, ENC_BIG_ENDIAN);
2810 offset++;
2812 proto_tree_add_item(tree, hf_dcbx_feature_pg_per_6, tvb, offset, 1, ENC_BIG_ENDIAN);
2814 offset++;
2816 proto_tree_add_item(tree, hf_dcbx_feature_pg_per_7, tvb, offset, 1, ENC_BIG_ENDIAN);
2818 offset++;
2820 /* TSA Assignment Table */
2821 proto_tree_add_item(tree, hf_ieee_8021az_tsa_class0, tvb, offset, 1, ENC_BIG_ENDIAN);
2823 offset++;
2825 proto_tree_add_item(tree, hf_ieee_8021az_tsa_class1, tvb, offset, 1, ENC_BIG_ENDIAN);
2827 offset++;
2829 proto_tree_add_item(tree, hf_ieee_8021az_tsa_class2, tvb, offset, 1, ENC_BIG_ENDIAN);
2831 offset++;
2833 proto_tree_add_item(tree, hf_ieee_8021az_tsa_class3, tvb, offset, 1, ENC_BIG_ENDIAN);
2835 offset++;
2837 proto_tree_add_item(tree, hf_ieee_8021az_tsa_class4, tvb, offset, 1, ENC_BIG_ENDIAN);
2839 offset++;
2841 proto_tree_add_item(tree, hf_ieee_8021az_tsa_class5, tvb, offset, 1, ENC_BIG_ENDIAN);
2843 offset++;
2845 proto_tree_add_item(tree, hf_ieee_8021az_tsa_class6, tvb, offset, 1, ENC_BIG_ENDIAN);
2847 offset++;
2849 proto_tree_add_item(tree, hf_ieee_8021az_tsa_class7, tvb, offset, 1, ENC_BIG_ENDIAN);
2851 offset++;
2853 break;
2855 case 0xA: /* ETS Recommendation */
2857 proto_tree_add_item(tree, hf_dcbx_feature_pgid_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
2859 offset++;
2861 /* Priority Assignment Table */
2862 proto_tree_add_item(tree, hf_dcbx_feature_pgid_prio_0, tvb, offset, 2, ENC_BIG_ENDIAN);
2863 proto_tree_add_item(tree, hf_dcbx_feature_pgid_prio_1, tvb, offset, 2, ENC_BIG_ENDIAN);
2864 proto_tree_add_item(tree, hf_dcbx_feature_pgid_prio_2, tvb, offset, 2, ENC_BIG_ENDIAN);
2865 proto_tree_add_item(tree, hf_dcbx_feature_pgid_prio_3, tvb, offset, 2, ENC_BIG_ENDIAN);
2867 offset +=2;
2869 proto_tree_add_item(tree, hf_dcbx_feature_pgid_prio_4, tvb, offset, 2, ENC_BIG_ENDIAN);
2870 proto_tree_add_item(tree, hf_dcbx_feature_pgid_prio_5, tvb, offset, 2, ENC_BIG_ENDIAN);
2871 proto_tree_add_item(tree, hf_dcbx_feature_pgid_prio_6, tvb, offset, 2, ENC_BIG_ENDIAN);
2872 proto_tree_add_item(tree, hf_dcbx_feature_pgid_prio_7, tvb, offset, 2, ENC_BIG_ENDIAN);
2874 offset +=2;
2876 /* TC Bandwidth Table */
2877 proto_tree_add_item(tree, hf_dcbx_feature_pg_per_0, tvb, offset, 1, ENC_BIG_ENDIAN);
2879 offset++;
2881 proto_tree_add_item(tree, hf_dcbx_feature_pg_per_1, tvb, offset, 1, ENC_BIG_ENDIAN);
2883 offset++;
2885 proto_tree_add_item(tree, hf_dcbx_feature_pg_per_2, tvb, offset, 1, ENC_BIG_ENDIAN);
2887 offset++;
2889 proto_tree_add_item(tree, hf_dcbx_feature_pg_per_3, tvb, offset, 1, ENC_BIG_ENDIAN);
2891 offset++;
2893 proto_tree_add_item(tree, hf_dcbx_feature_pg_per_4, tvb, offset, 1, ENC_BIG_ENDIAN);
2895 offset++;
2897 proto_tree_add_item(tree, hf_dcbx_feature_pg_per_5, tvb, offset, 1, ENC_BIG_ENDIAN);
2899 offset++;
2901 proto_tree_add_item(tree, hf_dcbx_feature_pg_per_6, tvb, offset, 1, ENC_BIG_ENDIAN);
2903 offset++;
2905 proto_tree_add_item(tree, hf_dcbx_feature_pg_per_7, tvb, offset, 1, ENC_BIG_ENDIAN);
2907 offset++;
2909 /* TSA Assignment Table */
2910 proto_tree_add_item(tree, hf_ieee_8021az_tsa_class0, tvb, offset, 1, ENC_BIG_ENDIAN);
2912 offset++;
2914 proto_tree_add_item(tree, hf_ieee_8021az_tsa_class1, tvb, offset, 1, ENC_BIG_ENDIAN);
2916 offset++;
2918 proto_tree_add_item(tree, hf_ieee_8021az_tsa_class2, tvb, offset, 1, ENC_BIG_ENDIAN);
2920 offset++;
2922 proto_tree_add_item(tree, hf_ieee_8021az_tsa_class3, tvb, offset, 1, ENC_BIG_ENDIAN);
2924 offset++;
2926 proto_tree_add_item(tree, hf_ieee_8021az_tsa_class4, tvb, offset, 1, ENC_BIG_ENDIAN);
2928 offset++;
2930 proto_tree_add_item(tree, hf_ieee_8021az_tsa_class5, tvb, offset, 1, ENC_BIG_ENDIAN);
2932 offset++;
2934 proto_tree_add_item(tree, hf_ieee_8021az_tsa_class6, tvb, offset, 1, ENC_BIG_ENDIAN);
2936 offset++;
2938 proto_tree_add_item(tree, hf_ieee_8021az_tsa_class7, tvb, offset, 1, ENC_BIG_ENDIAN);
2940 offset++;
2942 break;
2944 case 0xB: /* PFC Configuration */
2946 proto_tree_add_item(tree, hf_ieee_8021az_feature_flag_willing, tvb, offset, 1, ENC_BIG_ENDIAN);
2947 proto_tree_add_item(tree, hf_ieee_8021az_feature_flag_mbc, tvb, offset, 1, ENC_BIG_ENDIAN);
2948 proto_tree_add_item(tree, hf_ieee_8021az_pfc_numtcs, tvb, offset, 1, ENC_BIG_ENDIAN);
2950 offset++;
2952 proto_tree_add_item(tree, hf_dcbx_feature_pfc_prio0, tvb, offset, 1, ENC_BIG_ENDIAN);
2953 proto_tree_add_item(tree, hf_dcbx_feature_pfc_prio1, tvb, offset, 1, ENC_BIG_ENDIAN);
2954 proto_tree_add_item(tree, hf_dcbx_feature_pfc_prio2, tvb, offset, 1, ENC_BIG_ENDIAN);
2955 proto_tree_add_item(tree, hf_dcbx_feature_pfc_prio3, tvb, offset, 1, ENC_BIG_ENDIAN);
2956 proto_tree_add_item(tree, hf_dcbx_feature_pfc_prio4, tvb, offset, 1, ENC_BIG_ENDIAN);
2957 proto_tree_add_item(tree, hf_dcbx_feature_pfc_prio5, tvb, offset, 1, ENC_BIG_ENDIAN);
2958 proto_tree_add_item(tree, hf_dcbx_feature_pfc_prio6, tvb, offset, 1, ENC_BIG_ENDIAN);
2959 proto_tree_add_item(tree, hf_dcbx_feature_pfc_prio7, tvb, offset, 1, ENC_BIG_ENDIAN);
2961 offset++;
2963 break;
2965 case 0xC: /* Application Priority */
2967 proto_tree_add_item(tree, hf_ieee_8021az_app_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
2969 offset++;
2971 appCount = tvb_reported_length_remaining(tvb, offset)/3;
2973 while(appCount--) {
2974 dcbApp = tvb_get_ntohs(tvb, offset + 1);
2976 apptlv_tree = proto_tree_add_subtree_format(tree, tvb, offset, 3,
2977 ett_org_spc_ieee_dcbx_app, NULL, "%s Application",
2978 val_to_str_const(dcbApp, dcbx_app_types, "Unknown"));
2980 proto_tree_add_item(apptlv_tree, hf_ieee_8021az_app_prio, tvb, offset, 1, ENC_BIG_ENDIAN);
2981 proto_tree_add_item(apptlv_tree, hf_ieee_8021az_app_selector, tvb, offset, 1, ENC_BIG_ENDIAN);
2983 offset++;
2985 proto_tree_add_item(apptlv_tree, hf_dcbx_feature_app_proto, tvb, offset, 2, ENC_BIG_ENDIAN);
2987 offset += 2;
2989 break;
2993 return offset;
2996 /* Dissect IEEE 802.1Qbg TLVs */
2997 static void
2998 dissect_oui_default_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
3000 proto_tree_add_item(tree, hf_unknown_subtype, tvb, 0, 1, ENC_BIG_ENDIAN);
3001 if (tvb_captured_length_remaining(tvb, 1) > 0) {
3002 proto_tree_add_item(tree, hf_unknown_subtype_content, tvb, 1, -1, ENC_NA);
3006 static void
3007 dissect_ieee_802_1qbg_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
3009 uint8_t subType;
3010 uint32_t offset = 0;
3012 proto_tree *evb_capabilities_subtree = NULL;
3014 proto_item *tf = NULL;
3015 subType = tvb_get_uint8(tvb, offset);
3017 proto_tree_add_item(tree, hf_ieee_802_1qbg_subtype, tvb, offset, 1, ENC_BIG_ENDIAN);
3019 offset++;
3021 switch (subType) {
3022 case 0x00:
3023 /* Get EVB capabilities */
3024 tf = proto_tree_add_item(tree, hf_ieee_802_1qbg_evb_support_caps, tvb, offset, 2, ENC_BIG_ENDIAN);
3025 evb_capabilities_subtree = proto_item_add_subtree(tf, ett_802_1qbg_capabilities_flags);
3027 proto_tree_add_item(evb_capabilities_subtree, hf_ieee_802_1qbg_evb_support_caps_std, tvb, offset, 2, ENC_BIG_ENDIAN);
3028 proto_tree_add_item(evb_capabilities_subtree, hf_ieee_802_1qbg_evb_support_caps_rr, tvb, offset, 2, ENC_BIG_ENDIAN);
3029 proto_tree_add_item(evb_capabilities_subtree, hf_ieee_802_1qbg_evb_support_caps_rte, tvb, offset, 2, ENC_BIG_ENDIAN);
3030 proto_tree_add_item(evb_capabilities_subtree, hf_ieee_802_1qbg_evb_support_caps_ecp, tvb, offset, 2, ENC_BIG_ENDIAN);
3031 proto_tree_add_item(evb_capabilities_subtree, hf_ieee_802_1qbg_evb_support_caps_vdp, tvb, offset, 2, ENC_BIG_ENDIAN);
3033 offset += 2;
3035 tf = proto_tree_add_item(tree, hf_ieee_802_1qbg_evb_configure_caps, tvb, offset, 2, ENC_BIG_ENDIAN);
3036 evb_capabilities_subtree = proto_item_add_subtree(tf, ett_802_1qbg_capabilities_flags);
3038 proto_tree_add_item(evb_capabilities_subtree, hf_ieee_802_1qbg_evb_configure_caps_std, tvb, offset, 2, ENC_BIG_ENDIAN);
3039 proto_tree_add_item(evb_capabilities_subtree, hf_ieee_802_1qbg_evb_configure_caps_rr, tvb, offset, 2, ENC_BIG_ENDIAN);
3040 proto_tree_add_item(evb_capabilities_subtree, hf_ieee_802_1qbg_evb_configure_caps_rte, tvb, offset, 2, ENC_BIG_ENDIAN);
3041 proto_tree_add_item(evb_capabilities_subtree, hf_ieee_802_1qbg_evb_configure_caps_ecp, tvb, offset, 2, ENC_BIG_ENDIAN);
3042 proto_tree_add_item(evb_capabilities_subtree, hf_ieee_802_1qbg_evb_configure_caps_vdp, tvb, offset, 2, ENC_BIG_ENDIAN);
3044 offset += 2;
3046 proto_tree_add_item(tree, hf_ieee_802_1qbg_evb_supported_vsi, tvb, offset, 2, ENC_BIG_ENDIAN);
3048 offset += 2;
3050 proto_tree_add_item(tree, hf_ieee_802_1qbg_evb_configured_vsi, tvb, offset, 2, ENC_BIG_ENDIAN);
3052 offset += 2;
3054 proto_tree_add_item(tree, hf_ieee_802_1qbg_evb_retrans_timer, tvb, offset, 1, ENC_BIG_ENDIAN);
3056 break;
3059 return;
3063 /* Dissect extreme avaya ap tlv*/
3064 static int
3065 dissect_extreme_avaya_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, uint16_t dataLen)
3067 uint8_t subType;
3068 uint32_t i, loopCount;
3069 uint32_t offset = 0;
3072 Element TLV:
3073 ___________________________________________________________________________________________________________________________
3074 | TLV Type | TLV Length | Avaya OUI | Subtype | HMAC-SHA Digest | Element Type | State | Mgmt. VLAN | Rsvd | System ID |
3075 ----------------------------------------------------------------------------------------------------------------------------
3076 | 7 bits | 9 bits | 3 octets | 1 octet | 32 octets | 6 bits | 6 bits | 12 bits | 1 octet | 10 octets |
3077 ----------------------------------------------------------------------------------------------------------------------------
3079 Assignment TLV:
3080 __________________________________________________________________________________________________________
3081 | TLV Type | TLV Length | Avaya OUI | Subtype | HMAC-SHA Digest | Assignment Status | VLAN | I-SID |
3082 ----------------------------------------------------------------------------------------------------------
3083 | 7 bits | 9 bits | 3 octets | 1 octet | 32 octets | 4 bits | 12 bits | 3 octets |
3084 ----------------------------------------------------------------------------------------------------------
3087 /* Get subtype */
3088 subType = tvb_get_uint8(tvb, offset);
3089 proto_tree_add_item(tree, hf_ex_avaya_tlv_subtype, tvb, offset, 1, ENC_BIG_ENDIAN);
3090 offset++;
3091 switch (subType)
3093 case EX_AVAYA_SUBTYPE_ELEMENT_TLV: /* Element TLV */
3095 proto_tree_add_item(tree, hf_ex_avaya_hmac_shi, tvb, offset, 32, ENC_NA);
3096 offset+=32;
3097 proto_tree_add_item(tree, hf_ex_avaya_element_type, tvb, offset, 3, ENC_BIG_ENDIAN);
3098 proto_tree_add_item(tree, hf_ex_avaya_state, tvb, offset, 3, ENC_BIG_ENDIAN);
3099 proto_tree_add_item(tree, hf_ex_avaya_mgnt_vlan, tvb, offset, 3, ENC_BIG_ENDIAN);
3100 offset+=3;
3101 proto_tree_add_item(tree, hf_ex_avaya_rsvd, tvb, offset, 1, ENC_BIG_ENDIAN);
3102 offset+=1;
3103 proto_tree_add_item(tree, hf_ex_avaya_system_id, tvb, offset, 10, ENC_NA);
3104 offset+=10;
3105 break;
3107 case EX_AVAYA_SUBTYPE_ASSIGNMENT_TLV: /* Assignment TLV */
3109 loopCount = (dataLen - 36) / 5;
3110 proto_tree_add_item(tree, hf_ex_avaya_hmac_shi, tvb, offset, 32, ENC_NA);
3111 offset+=32;
3112 for ( i=0; i < loopCount; i++)
3114 proto_tree_add_item(tree, hf_ex_avaya_status, tvb, offset, 2, ENC_BIG_ENDIAN);
3115 proto_tree_add_item(tree, hf_ex_avaya_vlan, tvb, offset, 2, ENC_BIG_ENDIAN);
3116 offset+=2;
3117 proto_tree_add_item(tree, hf_ex_avaya_i_sid, tvb, offset, 3, ENC_BIG_ENDIAN);
3118 offset+=3;
3120 break;
3123 return offset;
3126 /* Dissect extreme avaya ap tlv*/
3127 static int
3128 dissect_extreme_avaya2_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
3130 uint8_t subType;
3131 uint32_t numbvlans, sysidlength;
3132 uint32_t offset = 0;
3135 Fabric TLV:
3136 _________________________________________________________________________________________________
3137 | TLV Type | TLV Length | Avaya OUI | Subtype | Num. BVLANs | BVLAN-ID*N | SysID Len | Sysid |
3138 -------------------------------------------------------------------------------------------------
3139 | 7 bits | 9 bits | 3 octets | 1 octet | 1 octet | 2 octets*N | 1 octet | octets*N |
3140 -------------------------------------------------------------------------------------------------
3143 /* Get subtype */
3144 subType = tvb_get_uint8(tvb, offset);
3145 proto_tree_add_item(tree, hf_ex_avaya2_tlv_subtype, tvb, offset, 1, ENC_BIG_ENDIAN);
3146 offset++;
3147 switch (subType) {
3148 case EX_AVAYA2_SUBTYPE_ZTFv2_FC_TLV: /* Zero Touch Fabric v2 Fabric Connect TLV */
3149 proto_tree_add_item(tree, hf_ex_avaya2_fabric_connect, tvb, offset, 1, ENC_NA);
3150 offset++;
3151 proto_tree_add_item_ret_uint(tree, hf_ex_avaya2_fabric_numbvlans, tvb, offset, 1, ENC_NA, &numbvlans);
3152 offset++;
3153 while (numbvlans--) {
3154 proto_tree_add_item(tree, hf_ex_avaya2_fabric_bvlanid, tvb, offset, 2, ENC_BIG_ENDIAN);
3155 offset += 2;
3157 proto_tree_add_item_ret_uint(tree, hf_ex_avaya2_fabric_sysidlength, tvb, offset, 1, ENC_NA, &sysidlength);
3158 offset++;
3159 proto_tree_add_item(tree, hf_ex_avaya2_fabric_sysid, tvb, offset, sysidlength, ENC_NA);
3160 offset += sysidlength;
3161 break;
3163 return offset;
3166 /* Dissect IEEE 802.3 TLVs */
3167 static int
3168 dissect_ieee_802_3_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
3170 uint8_t subType;
3171 uint32_t offset = 0;
3172 uint8_t tempByte;
3173 uint16_t tlvLen = tvb_reported_length(tvb)-offset;
3175 proto_tree *mac_phy_flags = NULL;
3176 proto_tree *autoneg_advertised_subtree = NULL;
3178 proto_item *tf = NULL, *subitem;
3180 /* Get subtype */
3181 subType = tvb_get_uint8(tvb, offset);
3183 subitem = proto_tree_add_item(tree, hf_ieee_802_3_subtype, tvb, offset, 1, ENC_BIG_ENDIAN);
3185 offset++;
3187 switch (subType)
3189 case 0x01: /* MAC/PHY Configuration/Status */
3191 /* Get auto-negotiation info */
3192 tf = proto_tree_add_item(tree, hf_ieee_802_3_mac_phy_auto_neg_status, tvb, offset, 1, ENC_BIG_ENDIAN);
3193 mac_phy_flags = proto_item_add_subtree(tf, ett_802_3_flags);
3195 proto_tree_add_item(mac_phy_flags, hf_ieee_802_3_mac_phy_auto_neg_status_supported, tvb, offset, 1, ENC_BIG_ENDIAN);
3196 proto_tree_add_item(mac_phy_flags, hf_ieee_802_3_mac_phy_auto_neg_status_enabled, tvb, offset, 1, ENC_BIG_ENDIAN);
3198 offset++;
3200 /* Get pmd auto-negotiation advertised capability */
3201 tf = proto_tree_add_item(tree, hf_ieee_802_3_pmd_auto_neg_advertised_caps, tvb, offset, 2, ENC_BIG_ENDIAN);
3202 autoneg_advertised_subtree = proto_item_add_subtree(tf, ett_802_3_autoneg_advertised);
3204 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_1000base_tfd, tvb, offset, 2, ENC_BIG_ENDIAN);
3205 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_1000base_t, tvb, offset, 2, ENC_BIG_ENDIAN);
3206 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_1000base_xfd, tvb, offset, 2, ENC_BIG_ENDIAN);
3207 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_1000base_x, tvb, offset, 2, ENC_BIG_ENDIAN);
3208 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_fdx_bpause, tvb, offset, 2, ENC_BIG_ENDIAN);
3209 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_fdx_spause, tvb, offset, 2, ENC_BIG_ENDIAN);
3210 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_fdx_apause, tvb, offset, 2, ENC_BIG_ENDIAN);
3211 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_fdx_pause, tvb, offset, 2, ENC_BIG_ENDIAN);
3212 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_100base_t2fd, tvb, offset, 2, ENC_BIG_ENDIAN);
3213 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_100base_t2, tvb, offset, 2, ENC_BIG_ENDIAN);
3214 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_100base_txfd, tvb, offset, 2, ENC_BIG_ENDIAN);
3215 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_100base_tx, tvb, offset, 2, ENC_BIG_ENDIAN);
3216 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_100base_t4, tvb, offset, 2, ENC_BIG_ENDIAN);
3217 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_10base_tfd, tvb, offset, 2, ENC_BIG_ENDIAN);
3218 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_10base_t, tvb, offset, 2, ENC_BIG_ENDIAN);
3219 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_other, tvb, offset, 2, ENC_BIG_ENDIAN);
3221 autoneg_advertised_subtree = proto_tree_add_subtree(tree, tvb, offset, 2, ett_802_3_autoneg_advertised, NULL, "Same in inverse (wrong) bitorder");
3223 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_1000base_tfd, tvb, offset, 2, ENC_BIG_ENDIAN);
3224 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_1000base_t, tvb, offset, 2, ENC_BIG_ENDIAN);
3225 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_1000base_xfd, tvb, offset, 2, ENC_BIG_ENDIAN);
3226 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_1000base_x, tvb, offset, 2, ENC_BIG_ENDIAN);
3227 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_fdx_bpause, tvb, offset, 2, ENC_BIG_ENDIAN);
3228 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_fdx_spause, tvb, offset, 2, ENC_BIG_ENDIAN);
3229 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_fdx_apause, tvb, offset, 2, ENC_BIG_ENDIAN);
3230 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_fdx_pause, tvb, offset, 2, ENC_BIG_ENDIAN);
3231 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_100base_t2fd, tvb, offset, 2, ENC_BIG_ENDIAN);
3232 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_100base_t2, tvb, offset, 2, ENC_BIG_ENDIAN);
3233 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_100base_txfd, tvb, offset, 2, ENC_BIG_ENDIAN);
3234 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_100base_tx, tvb, offset, 2, ENC_BIG_ENDIAN);
3235 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_100base_t4, tvb, offset, 2, ENC_BIG_ENDIAN);
3236 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_10base_tfd, tvb, offset, 2, ENC_BIG_ENDIAN);
3237 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_10base_t, tvb, offset, 2, ENC_BIG_ENDIAN);
3238 proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_other, tvb, offset, 2, ENC_BIG_ENDIAN);
3240 offset += 2;
3242 /* Get operational MAU type */
3243 proto_tree_add_item(tree, hf_ieee_802_3_pmd_mau_type, tvb, offset, 2, ENC_BIG_ENDIAN);
3245 offset += 2;
3247 break;
3249 case 0x02: /* MDI Power Support */
3251 /* Get MDI power support info */
3252 tf = proto_tree_add_item(tree, hf_ieee_802_3_mdi_power_support, tvb, offset, 1, ENC_BIG_ENDIAN);
3253 mac_phy_flags = proto_item_add_subtree(tf, ett_802_3_power);
3255 proto_tree_add_item(mac_phy_flags, hf_ieee_802_3_mdi_power_support_port_class, tvb, offset, 1, ENC_BIG_ENDIAN);
3256 proto_tree_add_item(mac_phy_flags, hf_ieee_802_3_mdi_power_support_pse_power_support, tvb, offset, 1, ENC_BIG_ENDIAN);
3257 proto_tree_add_item(mac_phy_flags, hf_ieee_802_3_mdi_power_support_pse_power_enabled, tvb, offset, 1, ENC_BIG_ENDIAN);
3258 proto_tree_add_item(mac_phy_flags, hf_ieee_802_3_mdi_power_support_pse_pairs, tvb, offset, 1, ENC_BIG_ENDIAN);
3260 offset++;
3262 /* Get PSE power pair */
3263 proto_tree_add_item(tree, hf_ieee_802_3_mdi_power_pse_pair, tvb, offset, 1, ENC_BIG_ENDIAN);
3265 offset++;
3267 /* Get power class */
3268 proto_tree_add_item(tree, hf_ieee_802_3_mdi_power_class, tvb, offset, 1, ENC_BIG_ENDIAN);
3270 offset++;
3272 if (tlvLen == 4)
3273 break;
3275 /* Get first byte */
3276 tempByte = tvb_get_uint8(tvb, offset);
3278 /* Determine power type */
3279 subType = ((tempByte & 0xC0) >> 6);
3280 proto_tree_add_item(tree, hf_ieee_802_3_mdi_power_type, tvb, offset, 1, ENC_BIG_ENDIAN);
3282 tf = proto_tree_add_item(tree, hf_ieee_802_3_mdi_power_source, tvb, offset, 1, ENC_BIG_ENDIAN);
3284 /* Determine power source subtype */
3285 switch (subType)
3287 case 0:
3288 case 2:
3290 subType = ((tempByte & 0x30) >> 4);
3291 proto_item_append_text(tf, " %s", val_to_str_const(subType, media_power_pse_device, "Reserved"));
3293 break;
3295 case 1:
3296 case 3:
3298 subType = ((tempByte & 0x30) >> 4);
3299 proto_item_append_text(tf, " %s", val_to_str_const(subType, media_power_pd_device, "Reserved"));
3301 break;
3303 default:
3305 proto_item_append_text(tf, " %s", "Unknown");
3307 break;
3311 /* Determine PD 4PID flag */
3312 proto_tree_add_item(tree, hf_ieee_802_3_mdi_power_pd4pid, tvb, offset, 1, ENC_BIG_ENDIAN);
3314 /* Determine power priority */
3315 proto_tree_add_item(tree, hf_ieee_802_3_mdi_power_priority, tvb, offset, 1, ENC_BIG_ENDIAN);
3317 offset++;
3319 /* Power Value: 1 to 510 expected */
3320 proto_tree_add_item(tree, hf_ieee_802_3_mdi_requested_power, tvb, offset, 2, ENC_BIG_ENDIAN);
3322 offset+=2;
3324 /* Power Value: 1 to 510 expected */
3325 proto_tree_add_item(tree, hf_ieee_802_3_mdi_allocated_power, tvb, offset, 2, ENC_BIG_ENDIAN);
3327 offset+=2;
3329 if (tlvLen == 26) { /* 802.3BT TLV Extensions */
3330 proto_tree_add_item(tree, hf_ieee_802_3_bt_ds_pd_requested_power_value_mode_a, tvb, offset, 2, ENC_BIG_ENDIAN);
3331 offset+=2;
3333 proto_tree_add_item(tree, hf_ieee_802_3_bt_ds_pd_requested_power_value_mode_b, tvb, offset, 2, ENC_BIG_ENDIAN);
3334 offset+=2;
3336 proto_tree_add_item(tree, hf_ieee_802_3_bt_ds_pse_allocated_power_value_alt_a, tvb, offset, 2, ENC_BIG_ENDIAN);
3337 offset+=2;
3339 proto_tree_add_item(tree, hf_ieee_802_3_bt_ds_pse_allocated_power_value_alt_b, tvb, offset, 2, ENC_BIG_ENDIAN);
3340 offset+=2;
3342 tf = proto_tree_add_item(tree, hf_ieee_802_3_bt_power_status, tvb, offset, 2, ENC_BIG_ENDIAN);
3343 mac_phy_flags = proto_item_add_subtree(tf, ett_802_3_bt_power);
3345 proto_tree_add_item(mac_phy_flags, hf_ieee_802_3_bt_pse_powering_status, tvb, offset, 2, ENC_BIG_ENDIAN);
3346 proto_tree_add_item(mac_phy_flags, hf_ieee_802_3_bt_pd_powered_status, tvb, offset, 2, ENC_BIG_ENDIAN);
3347 proto_tree_add_item(mac_phy_flags, hf_ieee_802_3_bt_pse_power_pairs_ext, tvb, offset, 2, ENC_BIG_ENDIAN);
3348 proto_tree_add_item(mac_phy_flags, hf_ieee_802_3_bt_ds_pwr_class_ext_a, tvb, offset, 2, ENC_BIG_ENDIAN);
3349 proto_tree_add_item(mac_phy_flags, hf_ieee_802_3_bt_ds_pwr_class_ext_b, tvb, offset, 2, ENC_BIG_ENDIAN);
3350 proto_tree_add_item(mac_phy_flags, hf_ieee_802_3_bt_pwr_class_ext, tvb, offset, 2, ENC_BIG_ENDIAN);
3351 offset+=2;
3353 tf = proto_tree_add_item(tree, hf_ieee_802_3_bt_system_setup, tvb, offset, 1, ENC_BIG_ENDIAN);
3354 mac_phy_flags = proto_item_add_subtree(tf, ett_802_3_bt_system_setup);
3356 proto_tree_add_item(mac_phy_flags, hf_ieee_802_3_bt_power_type_ext, tvb, offset, 1, ENC_BIG_ENDIAN);
3357 proto_tree_add_item(mac_phy_flags, hf_ieee_802_3_bt_power_pd_load, tvb, offset, 1, ENC_BIG_ENDIAN);
3358 offset+=1;
3360 proto_tree_add_item(tree, hf_ieee_802_3_bt_pse_maximum_available_power_value, tvb, offset, 2, ENC_BIG_ENDIAN);
3361 offset+=2;
3363 tf = proto_tree_add_item(tree, hf_ieee_802_3_bt_autoclass, tvb, offset, 1, ENC_BIG_ENDIAN);
3364 mac_phy_flags = proto_item_add_subtree(tf, ett_802_3_bt_autoclass);
3366 proto_tree_add_item(mac_phy_flags, hf_ieee_802_3_bt_pse_autoclass_support, tvb, offset, 1, ENC_BIG_ENDIAN);
3367 proto_tree_add_item(mac_phy_flags, hf_ieee_802_3_bt_autoclass_completed, tvb, offset, 1, ENC_BIG_ENDIAN);
3368 proto_tree_add_item(mac_phy_flags, hf_ieee_802_3_bt_autoclass_request, tvb, offset, 1, ENC_BIG_ENDIAN);
3369 proto_tree_add_item(mac_phy_flags, hf_ieee_802_3_bt_autoclass_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
3370 offset+=1;
3372 tf = proto_tree_add_item(tree, hf_ieee_802_3_bt_power_down, tvb, offset, 3, ENC_BIG_ENDIAN);
3373 mac_phy_flags = proto_item_add_subtree(tf, ett_802_3_bt_power_down);
3375 proto_tree_add_item(mac_phy_flags, hf_ieee_802_3_bt_power_down_request, tvb, offset, 3, ENC_BIG_ENDIAN);
3376 proto_tree_add_item(mac_phy_flags, hf_ieee_802_3_bt_power_down_time, tvb, offset, 3, ENC_BIG_ENDIAN);
3377 offset+=3;
3379 break;
3381 case 0x03: /* Link Aggregation */
3383 /* Get aggregation status */
3384 expert_add_info(pinfo, subitem, &ei_lldp_tlv_deprecated);
3385 tf = proto_tree_add_item(tree, hf_ieee_802_3_aggregation_status, tvb, offset, 1, ENC_BIG_ENDIAN);
3386 mac_phy_flags = proto_item_add_subtree(tf, ett_802_3_aggregation);
3387 proto_tree_add_item(mac_phy_flags, hf_ieee_802_3_aggregation_status_cap, tvb, offset, 1, ENC_BIG_ENDIAN);
3388 proto_tree_add_item(mac_phy_flags, hf_ieee_802_3_aggregation_status_enabled, tvb, offset, 1, ENC_BIG_ENDIAN);
3390 offset++;
3392 /* Get aggregated port id */
3393 proto_tree_add_item(tree, hf_ieee_802_3_aggregated_port_id, tvb, offset, 4, ENC_BIG_ENDIAN);
3395 offset+=4;
3396 break;
3398 case 0x04: /* Maximum Frame Size */
3400 /* Get maximum frame size */
3401 proto_tree_add_item(tree, hf_ieee_802_3_max_frame_size, tvb, offset, 2, ENC_BIG_ENDIAN);
3403 offset+=2;
3404 break;
3406 case 0x05: /* Energy-Efficient Ethernet */
3408 proto_tree_add_item(tree, hf_ieee_802_3_eee_transmit, tvb, offset, 2, ENC_BIG_ENDIAN);
3409 offset+=2;
3411 proto_tree_add_item(tree, hf_ieee_802_3_eee_receive, tvb, offset, 2, ENC_BIG_ENDIAN);
3412 offset+=2;
3414 proto_tree_add_item(tree, hf_ieee_802_3_eee_fallback_receive, tvb, offset, 2, ENC_BIG_ENDIAN);
3415 offset+=2;
3417 proto_tree_add_item(tree, hf_ieee_802_3_eee_echo_transmit, tvb, offset, 2, ENC_BIG_ENDIAN);
3418 offset+=2;
3420 proto_tree_add_item(tree, hf_ieee_802_3_eee_echo_receive, tvb, offset, 2, ENC_BIG_ENDIAN);
3421 offset+=2;
3423 break;
3425 case 0x07: /* IEEE 802.3br Frame Preemption Protocol */
3427 static int * const preemption_capabilities[] = {
3428 &hf_ieee_802_3br_aec_support,
3429 &hf_ieee_802_3br_aec_enable,
3430 &hf_ieee_802_3br_aec_active,
3431 &hf_ieee_802_3br_aec_addfragsize,
3432 &hf_ieee_802_3br_aec_reserved,
3433 NULL
3436 /* Get Additional Ethernet Capabilities */
3437 proto_tree_add_bitmask(tree, tvb, offset, hf_ieee_802_3br_aec, ett_802_3br_capabilities_flags, preemption_capabilities, ENC_BIG_ENDIAN);
3438 offset+=2;
3439 break;
3443 if(tvb_reported_length_remaining(tvb, offset)) {
3444 proto_tree_add_expert(tree, pinfo, &ei_lldp_bad_length_excess, tvb, offset, -1);
3446 return offset;
3449 /* Dissect Media TLVs */
3450 static void
3451 dissect_media_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3453 uint16_t tlvLen = tvb_reported_length(tvb);
3454 uint8_t subType;
3455 uint32_t offset = 0;
3456 uint8_t tempByte;
3457 uint32_t LCI_Length;
3459 proto_tree *media_flags = NULL;
3460 proto_item *tf = NULL;
3461 /* Get subtype */
3462 subType = tvb_get_uint8(tvb, offset);
3463 proto_tree_add_item(tree, hf_media_tlv_subtype, tvb, offset, 1, ENC_BIG_ENDIAN);
3464 offset++;
3465 tlvLen--;
3467 switch (subType)
3469 case 1: /* LLDP-MED Capabilities */
3471 /* Get capabilities */
3472 if (tlvLen < 2)
3474 proto_tree_add_expert(tree, pinfo, &ei_lldp_bad_length, tvb, offset, tlvLen);
3475 return;
3478 tf = proto_tree_add_item(tree, hf_media_tlv_subtype_caps, tvb, offset, 2, ENC_BIG_ENDIAN);
3479 media_flags = proto_item_add_subtree(tf, ett_media_capabilities);
3480 proto_tree_add_item(media_flags, hf_media_tlv_subtype_caps_llpd, tvb, offset, 2, ENC_BIG_ENDIAN);
3481 proto_tree_add_item(media_flags, hf_media_tlv_subtype_caps_network_policy, tvb, offset, 2, ENC_BIG_ENDIAN);
3482 proto_tree_add_item(media_flags, hf_media_tlv_subtype_caps_location_id, tvb, offset, 2, ENC_BIG_ENDIAN);
3483 proto_tree_add_item(media_flags, hf_media_tlv_subtype_caps_mdi_pse, tvb, offset, 2, ENC_BIG_ENDIAN);
3484 proto_tree_add_item(media_flags, hf_media_tlv_subtype_caps_mid_pd, tvb, offset, 2, ENC_BIG_ENDIAN);
3485 proto_tree_add_item(media_flags, hf_media_tlv_subtype_caps_inventory, tvb, offset, 2, ENC_BIG_ENDIAN);
3487 offset += 2;
3488 tlvLen -= 2;
3490 /* Get Class type */
3491 if (tlvLen < 1)
3493 proto_tree_add_expert(tree, pinfo, &ei_lldp_bad_length, tvb, offset, tlvLen);
3494 return;
3497 proto_tree_add_item(tree, hf_media_tlv_subtype_class, tvb, offset, 1, ENC_BIG_ENDIAN);
3499 offset++;
3500 tlvLen--;
3502 break;
3504 case 2: /* Network Policy */
3506 /* Get application type */
3507 if (tlvLen < 1)
3509 proto_tree_add_expert(tree, pinfo, &ei_lldp_bad_length, tvb, offset, tlvLen);
3510 return;
3513 proto_tree_add_item(tree, hf_media_application_type, tvb, offset, 1, ENC_BIG_ENDIAN);
3515 offset++;
3516 tlvLen--;
3518 /* Get flags */
3519 if (tlvLen < 3)
3521 proto_tree_add_expert(tree, pinfo, &ei_lldp_bad_length, tvb, offset, tlvLen);
3522 return;
3525 proto_tree_add_item(tree, hf_media_policy_flag, tvb, offset, 3, ENC_BIG_ENDIAN);
3526 proto_tree_add_item(tree, hf_media_tag_flag, tvb, offset, 3, ENC_BIG_ENDIAN);
3528 /* Get vlan id */
3529 proto_tree_add_item(tree, hf_media_vlan_id, tvb, offset, 3, ENC_BIG_ENDIAN);
3532 /* Get L2 priority */
3534 proto_tree_add_item(tree, hf_media_l2_prio, tvb, offset, 3, ENC_BIG_ENDIAN);
3536 /* Get DSCP value */
3537 proto_tree_add_item(tree, hf_media_dscp, tvb, offset, 3, ENC_BIG_ENDIAN);
3539 break;
3541 case 3: /* Location Identification */
3543 /* Get location data format */
3544 if (tlvLen < 1)
3546 proto_tree_add_expert(tree, pinfo, &ei_lldp_bad_length, tvb, offset, tlvLen);
3547 return;
3550 tempByte = tvb_get_uint8(tvb, offset);
3551 proto_tree_add_item(tree, hf_media_loc_data_format, tvb, offset, 1, ENC_BIG_ENDIAN);
3553 offset++;
3554 tlvLen--;
3556 switch (tempByte)
3558 case 1: /* Coordinate-based LCI */
3561 * See RFC 6225 (obsoletes RFC 3825).
3562 * XXX - should this be handled by the BOOTP
3563 * dissector, and exported to us?
3565 if (tlvLen < 16)
3567 proto_tree_add_expert(tree, pinfo, &ei_lldp_bad_length, tvb, offset, tlvLen);
3568 return;
3571 /* Get latitude resolution */
3572 proto_tree_add_item(tree, hf_media_loc_lat_resolution, tvb, offset, 1, ENC_BIG_ENDIAN);
3574 /* Get latitude */
3575 proto_tree_add_item(tree, hf_media_loc_lat, tvb, offset, 5, ENC_BIG_ENDIAN);
3577 offset += 5;
3579 /* Get longitude resolution */
3580 proto_tree_add_item(tree, hf_media_loc_long_resolution, tvb, offset, 1, ENC_BIG_ENDIAN);
3582 /* Get longitude */
3583 proto_tree_add_item(tree, hf_media_loc_long, tvb, offset, 5, ENC_BIG_ENDIAN);
3585 offset += 5;
3587 /* Altitude Type */
3588 proto_tree_add_item(tree, hf_media_loc_alt_type, tvb, offset, 1, ENC_BIG_ENDIAN);
3590 /* Get Altitude Resolution */
3591 proto_tree_add_item(tree, hf_media_loc_alt_resolution, tvb, offset, 2, ENC_BIG_ENDIAN);
3593 offset++;
3595 /* Get Altitude */
3596 proto_tree_add_item(tree, hf_media_loc_alt, tvb, offset, 4, ENC_BIG_ENDIAN);
3598 offset += 4;
3600 /* Get Ver */
3601 proto_tree_add_item(tree, hf_media_loc_ver, tvb, offset, 1, ENC_BIG_ENDIAN);
3603 /* Get reserved */
3604 proto_tree_add_item(tree, hf_media_loc_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
3606 /* Get datum */
3607 proto_tree_add_item(tree, hf_media_loc_datum, tvb, offset, 1, ENC_BIG_ENDIAN);
3609 offset++;
3611 break;
3613 case 2: /* Civic Address LCI */
3616 * See draft-ietf-geopriv-dhcp-civil-07.
3617 * XXX - should this be handled by the BOOTP
3618 * dissector, and exported to us?
3620 if (tlvLen < 1)
3622 proto_tree_add_expert(tree, pinfo, &ei_lldp_bad_length, tvb, offset, tlvLen);
3623 return;
3626 /* Get LCI length */
3627 tempByte = tvb_get_uint8(tvb, offset);
3628 tlvLen--;
3629 if (tempByte > tlvLen)
3631 proto_tree_add_expert(tree, pinfo, &ei_lldp_bad_length_excess , tvb, offset, tlvLen);
3633 return;
3636 proto_tree_add_item(tree, hf_media_civic_lci_length, tvb, offset, 1 , ENC_BIG_ENDIAN);
3638 LCI_Length = (uint32_t)tempByte;
3640 offset++;
3642 /* Get what value */
3643 if (LCI_Length < 1)
3645 proto_tree_add_expert(tree, pinfo, &ei_lldp_bad_length, tvb, offset, tlvLen);
3646 return;
3649 proto_tree_add_item(tree, hf_media_civic_what, tvb, offset, 1, ENC_BIG_ENDIAN);
3651 offset++;
3652 LCI_Length--;
3654 /* Get country code */
3655 if (LCI_Length < 2)
3657 proto_tree_add_expert(tree, pinfo, &ei_lldp_bad_length, tvb, offset, tlvLen);
3658 return;
3661 proto_tree_add_item(tree, hf_media_civic_country, tvb, offset, 2, ENC_ASCII);
3663 offset += 2;
3664 LCI_Length -= 2;
3666 while (LCI_Length > 0)
3668 /* Get CA Type */
3669 proto_tree_add_item(tree, hf_media_civic_addr_type, tvb, offset, 1, ENC_BIG_ENDIAN);
3671 offset++;
3672 LCI_Length--;
3674 /* Get CA Length */
3675 if (LCI_Length < 1)
3677 proto_tree_add_expert(tree, pinfo, &ei_lldp_bad_length, tvb, offset, tlvLen);
3678 return;
3680 tempByte = tvb_get_uint8(tvb, offset);
3682 proto_tree_add_item(tree, hf_media_civic_addr_len, tvb, offset, 1, ENC_BIG_ENDIAN);
3684 offset++;
3685 LCI_Length--;
3687 /* Make sure the CA value is within the specified length */
3688 if (tempByte > LCI_Length)
3689 return;
3691 if (tempByte > 0)
3693 /* Get CA Value */
3694 proto_tree_add_item(tree, hf_media_civic_addr_value, tvb, offset, tempByte, ENC_ASCII);
3696 offset += tempByte;
3697 LCI_Length -= tempByte;
3701 break;
3703 case 3: /* ECS ELIN */
3705 if (tlvLen > 0)
3707 proto_tree_add_item(tree, hf_media_ecs, tvb, offset, tlvLen, ENC_ASCII);
3710 break;
3714 break;
3716 case 4: /* Extended Power-via-MDI */
3718 /* Get first byte */
3719 tempByte = tvb_get_uint8(tvb, offset);
3721 /* Determine power type */
3722 subType = ((tempByte & 0xC0) >> 6);
3723 proto_tree_add_item(tree, hf_media_power_type, tvb, offset, 1, ENC_BIG_ENDIAN);
3725 tf = proto_tree_add_item(tree, hf_media_power_source, tvb, offset, 1, ENC_BIG_ENDIAN);
3727 /* Determine power source */
3728 switch (subType)
3730 case 0:
3732 subType = ((tempByte & 0x30) >> 4);
3733 proto_item_append_text(tf, " %s", val_to_str_const(subType, media_power_pse_device, "Reserved"));
3735 break;
3737 case 1:
3739 subType = ((tempByte & 0x30) >> 4);
3740 proto_item_append_text(tf, " %s", val_to_str_const(subType, media_power_pd_device, "Reserved"));
3742 break;
3744 default:
3746 proto_item_append_text(tf, " %s", "Unknown");
3747 break;
3751 /* Determine power priority */
3752 proto_tree_add_item(tree, hf_media_power_priority, tvb, offset, 1, ENC_BIG_ENDIAN);
3754 offset++;
3756 /* Power Value: 0 to 102.3 Watts (0.1 W increments) */
3757 proto_tree_add_item(tree, hf_media_power_value, tvb, offset, 2, ENC_BIG_ENDIAN);
3759 break;
3761 case 5: /* Hardware Revision */
3763 /* Figure out the length of the hardware revision field */
3764 if (tlvLen > 0)
3766 proto_tree_add_item(tree, hf_media_hardware, tvb, offset, tlvLen, ENC_ASCII|ENC_NA);
3769 break;
3771 case 6: /* Firmware Revision */
3773 /* Figure out the length of the firmware revision field */
3774 if (tlvLen > 0)
3776 proto_tree_add_item(tree, hf_media_firmware, tvb, offset, tlvLen, ENC_ASCII|ENC_NA);
3779 break;
3781 case 7: /* Software Revision */
3783 /* Figure out the length of the software revision field */
3784 if (tlvLen > 0)
3786 proto_tree_add_item(tree, hf_media_software, tvb, offset, tlvLen, ENC_ASCII|ENC_NA);
3789 break;
3791 case 8: /* Serial Number */
3793 /* Figure out the length of the serial number field */
3794 if (tlvLen > 0)
3796 proto_tree_add_item(tree, hf_media_sn, tvb, offset, tlvLen, ENC_ASCII|ENC_NA);
3799 break;
3801 case 9: /* Manufacturer Name */
3803 /* Figure out the length of the manufacturer name field */
3804 if (tlvLen > 0)
3806 proto_tree_add_item(tree, hf_media_manufacturer, tvb, offset, tlvLen, ENC_ASCII|ENC_NA);
3809 break;
3811 case 10: /* Model Name */
3813 /* Figure out the length of the model name field */
3814 if (tlvLen > 0)
3816 proto_tree_add_item(tree, hf_media_model, tvb, offset, tlvLen, ENC_ASCII|ENC_NA);
3819 break;
3821 case 11: /* Asset ID */
3823 /* Figure out the length of the asset id field */
3824 if (tlvLen > 0)
3826 proto_tree_add_item(tree, hf_media_asset, tvb, offset, tlvLen, ENC_ASCII|ENC_NA);
3829 break;
3833 return;
3837 static uint32_t
3838 dissect_profinet_period(tvbuff_t *tvb, proto_tree *tree, uint32_t offset, const char *name, int hf_valid, int hf_value)
3840 uint32_t period;
3841 proto_tree *period_tree;
3843 period = tvb_get_ntohl(tvb, offset);
3845 period_tree = proto_tree_add_subtree_format(tree, tvb, offset, 4, ett_profinet_period, NULL, "%s: %s, %uns",
3846 name, (period & 0x80000000) ? "Valid" : "Invalid", period & 0x7FFFFFFF);
3848 proto_tree_add_uint(period_tree, hf_valid, tvb, offset, 4, period);
3849 proto_tree_add_uint(period_tree, hf_value, tvb, offset, 4, period);
3850 offset+=4;
3852 return offset;
3855 static void
3856 select_source_of_name_of_station
3857 (packet_info *pinfo _U_, profinet_lldp_column_info *pn_lldp_column_info)
3859 if (pn_lldp_column_info->chassis_id_locally_assigned != NULL)
3861 pn_lldp_column_info->is_nos_assigned = true;
3862 col_append_fstr(pinfo->cinfo, COL_INFO, "NoS = %s ", pn_lldp_column_info->chassis_id_locally_assigned);
3864 else
3866 if (pn_lldp_column_info->chassis_id_mac != NULL)
3868 pn_lldp_column_info->is_nos_assigned = true;
3869 col_append_fstr(pinfo->cinfo, COL_INFO, "NoS = %s ", pn_lldp_column_info->chassis_id_mac);
3874 static void
3875 set_name_of_station_for_profinet_specialized_column_info
3876 (packet_info *pinfo _U_, profinet_lldp_column_info *pn_lldp_column_info)
3878 const char *delimForProfinetv23 = ".";
3879 char* foundDot = NULL;
3880 char* tokenPortId = NULL;
3881 char* tokenNameOfStation = NULL;
3882 char* lldpPortIdCombinedWithNameOfStation = NULL;
3884 if (pn_lldp_column_info->is_nos_assigned != true)
3886 if (pn_lldp_column_info->port_id_locally_assigned != NULL)
3888 foundDot = strstr(pn_lldp_column_info->port_id_locally_assigned, delimForProfinetv23);
3889 if (foundDot != NULL)
3891 pn_lldp_column_info->is_nos_assigned = true;
3892 pn_lldp_column_info->is_port_id_assigned = true;
3893 lldpPortIdCombinedWithNameOfStation = wmem_strdup(pinfo->pool, pn_lldp_column_info->port_id_locally_assigned);
3894 tokenPortId = strtok(lldpPortIdCombinedWithNameOfStation, delimForProfinetv23);
3895 tokenNameOfStation = strtok(NULL, delimForProfinetv23);
3896 col_append_fstr(pinfo->cinfo, COL_INFO, "NoS = %s ", tokenNameOfStation);
3897 col_append_fstr(pinfo->cinfo, COL_INFO, "Port Id = %s ", tokenPortId);
3899 else
3901 select_source_of_name_of_station(pinfo, pn_lldp_column_info);
3904 else
3906 select_source_of_name_of_station(pinfo, pn_lldp_column_info);
3911 static void
3912 set_port_id_for_profinet_specialized_column_info
3913 (packet_info *pinfo _U_, profinet_lldp_column_info *pn_lldp_column_info)
3915 if (pn_lldp_column_info->is_port_id_assigned != true)
3917 if (pn_lldp_column_info->port_id_locally_assigned != NULL)
3919 pn_lldp_column_info->is_port_id_assigned = true;
3920 col_append_fstr(pinfo->cinfo, COL_INFO, "Port Id = %s ", pn_lldp_column_info->port_id_locally_assigned);
3925 /* Dissect PROFINET TLVs */
3926 static void
3927 dissect_profinet_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, profinet_lldp_column_info *pn_lldp_column_info)
3929 uint8_t subType;
3930 uint32_t offset = 0;
3931 proto_item *tf = NULL;
3932 uint32_t class3_PortStatus;
3933 uint32_t port_rx_delay_local;
3934 uint32_t port_rx_delay_remote;
3935 uint32_t port_tx_delay_local;
3936 uint32_t port_tx_delay_remote;
3937 uint32_t cable_delay_local;
3940 /* Get subtype */
3941 subType = tvb_get_uint8(tvb, offset);
3942 proto_tree_add_uint(tree, hf_profinet_tlv_subtype, tvb, offset, 1, subType);
3943 offset++;
3945 if (column_info_selection == PROFINET_SPECIAL_COLUMN_INFO)
3947 set_name_of_station_for_profinet_specialized_column_info(pinfo, pn_lldp_column_info);
3948 set_port_id_for_profinet_specialized_column_info(pinfo, pn_lldp_column_info);
3951 switch (subType)
3953 case 1: /* LLDP_PNIO_DELAY */
3955 port_rx_delay_local = tvb_get_ntohl(tvb, offset);
3956 tf = proto_tree_add_uint(tree, hf_profinet_port_rx_delay_local, tvb, offset, 4, port_rx_delay_local);
3957 if(port_rx_delay_local) {
3958 proto_item_append_text(tf, "ns");
3959 } else {
3960 proto_item_append_text(tf, " (unknown)");
3962 offset+=4;
3963 port_rx_delay_remote = tvb_get_ntohl(tvb, offset);
3964 tf = proto_tree_add_uint(tree, hf_profinet_port_rx_delay_remote, tvb, offset, 4, port_rx_delay_remote);
3965 if(port_rx_delay_remote) {
3966 proto_item_append_text(tf, "ns");
3967 } else {
3968 proto_item_append_text(tf, " (unknown)");
3970 offset+=4;
3971 port_tx_delay_local = tvb_get_ntohl(tvb, offset);
3972 tf = proto_tree_add_uint(tree, hf_profinet_port_tx_delay_local, tvb, offset, 4, port_tx_delay_local);
3973 if(port_tx_delay_local) {
3974 proto_item_append_text(tf, "ns");
3975 } else {
3976 proto_item_append_text(tf, " (unknown)");
3978 offset+=4;
3979 port_tx_delay_remote = tvb_get_ntohl(tvb, offset);
3980 tf = proto_tree_add_uint(tree, hf_profinet_port_tx_delay_remote, tvb, offset, 4, port_tx_delay_remote);
3981 if(port_tx_delay_remote) {
3982 proto_item_append_text(tf, "ns");
3983 } else {
3984 proto_item_append_text(tf, " (unknown)");
3986 offset+=4;
3987 cable_delay_local = tvb_get_ntohl(tvb, offset);
3988 tf = proto_tree_add_uint(tree, hf_profinet_cable_delay_local, tvb, offset, 4, cable_delay_local);
3989 if(cable_delay_local) {
3990 proto_item_append_text(tf, "ns");
3991 } else {
3992 proto_item_append_text(tf, " (unknown)");
3994 /*offset+=4;*/
3995 break;
3997 case 2: /* LLDP_PNIO_PORTSTATUS */
3999 proto_tree_add_item(tree, hf_profinet_class2_port_status, tvb, offset, 2, ENC_BIG_ENDIAN);
4000 offset+=2;
4001 proto_tree_add_item_ret_uint(tree, hf_profinet_class3_port_status, tvb, offset, 2, ENC_BIG_ENDIAN, &class3_PortStatus);
4002 proto_tree_add_item(tree, hf_profinet_class3_port_status_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
4003 proto_tree_add_item(tree, hf_profinet_class3_port_status_Fragmentation, tvb, offset, 2, ENC_BIG_ENDIAN);
4004 proto_tree_add_item(tree, hf_profinet_class3_port_status_PreambleLength, tvb, offset, 2, ENC_BIG_ENDIAN);
4006 col_append_fstr(pinfo->cinfo, COL_INFO, "RTClass3 Port Status = %s", val_to_str(class3_PortStatus, profinet_port3_status_vals, "Unknown %d"));
4007 /*offset+=2;*/
4008 break;
4010 /*case 3:*/ /* XXX - LLDP_PNIO_ALIAS */
4011 case 4: /* LLDP_PNIO_MRPPORTSTATUS */
4013 /* DomainUUID */
4014 proto_tree_add_item(tree, hf_profinet_mrp_domain_uuid, tvb, offset, 16, ENC_BIG_ENDIAN);
4015 offset += 16;
4017 /* MRRT PortStatus */
4018 proto_tree_add_item(tree, hf_profinet_mrrt_port_status, tvb, offset, 2, ENC_BIG_ENDIAN);
4019 /*offset+=2;*/
4020 break;
4022 case 5: /* LLDP_PNIO_CHASSIS_MAC */
4024 proto_tree_add_item(tree, hf_profinet_cm_mac, tvb, offset, 6, ENC_NA);
4025 /*offset += 6;*/
4026 break;
4028 case 6: /* LLDP_PNIO_PTCPSTATUS */
4030 /* MasterSourceAddress */
4031 proto_tree_add_item(tree, hf_profinet_master_source_address, tvb, offset, 6, ENC_NA);
4032 offset += 6;
4033 /* SubdomainUUID */
4034 proto_tree_add_item(tree, hf_profinet_subdomain_uuid, tvb, offset, 16, ENC_BIG_ENDIAN);
4035 offset += 16;
4036 /* IRDataUUID */
4037 proto_tree_add_item(tree, hf_profinet_ir_data_uuid, tvb, offset, 16, ENC_BIG_ENDIAN);
4038 offset += 16;
4039 /* LengthOfPeriod */
4040 offset = dissect_profinet_period(tvb, tree, offset, "LengthOfPeriod",
4041 hf_profinet_length_of_period_valid, hf_profinet_length_of_period_length);
4042 /* RedPeriodBegin */
4043 offset = dissect_profinet_period(tvb, tree, offset, "RedPeriodBegin",
4044 hf_profinet_red_period_begin_valid, hf_profinet_red_period_begin_offset);
4045 /* OrangePeriodBegin */
4046 offset = dissect_profinet_period(tvb, tree, offset, "OrangePeriodBegin",
4047 hf_profinet_orange_period_begin_valid, hf_profinet_orange_period_begin_offset);
4048 /* GreenPeriodBegin */
4049 /*offset = */dissect_profinet_period(tvb, tree, offset, "GreenPeriodBegin",
4050 hf_profinet_green_period_begin_valid, hf_profinet_green_period_begin_offset);
4051 break;
4053 case 9: /* LLDP_PNIO_TSNDOMAIN */
4055 /* DomainUUID */
4056 proto_tree_add_item(tree, hf_profinet_tsn_domain_uuid, tvb, offset, 16, ENC_BIG_ENDIAN);
4057 /*offset += 16;*/
4058 break;
4060 case 10: /* LLDP_PNIO_TSNNMEManagementAddr */
4062 uint8_t management_string_length = 0;
4063 management_string_length = tvb_get_uint8(tvb, offset);
4065 /* Management Address String Length */
4066 proto_tree_add_item(tree, hf_profinet_tsn_nme_management_addr_str_length, tvb, offset, 1, ENC_BIG_ENDIAN);
4067 offset += 1;
4069 /* Management Address Subtype */
4070 proto_tree_add_item(tree, hf_profinet_tsn_nme_management_addr_subtype, tvb, offset, 1, ENC_BIG_ENDIAN);
4071 offset += 1;
4072 management_string_length -= 1;
4074 /* Management Address */
4075 proto_tree_add_item(tree, hf_profinet_tsn_nme_management_addr, tvb, offset, management_string_length, ENC_NA);
4076 /*offset += management_string_length;*/
4077 break;
4079 case 11: /* LLDP_PNIO_TSNNMENameUUID */
4081 /* TSNNMENameUUID */
4082 proto_tree_add_item(tree, hf_profinet_tsn_nme_name_uuid, tvb, offset, 16, ENC_BIG_ENDIAN);
4083 /*offset += 16;*/
4084 break;
4086 case 12: /* LLDP_PNIO_TSNNMEParameterUUID */
4088 /* NMEParameterUUID */
4089 proto_tree_add_item(tree, hf_profinet_tsn_nme_parameter_uuid, tvb, offset, 16, ENC_BIG_ENDIAN);
4090 /*offset += 16;*/
4091 break;
4093 case 13: /* LLDP_PNIO_TSNTimeDomain */
4095 /*TimeDomainNumber*/
4096 proto_tree_add_item(tree, hf_profinet_time_domain_number, tvb, offset, 2, ENC_BIG_ENDIAN);
4097 offset += 2;
4099 /*TimeDomainUUID*/
4100 proto_tree_add_item(tree, hf_profinet_time_domain_uuid, tvb, offset, 16, ENC_BIG_ENDIAN);
4101 offset += 16;
4103 /*TimeDomainMasterIdentity*/
4104 proto_tree_add_item(tree, hf_profinet_time_domain_master_identity, tvb, offset, 8, ENC_NA);
4105 /*offset += 8;*/
4106 break;
4108 default:
4109 proto_tree_add_item(tree, hf_unknown_subtype_content, tvb, offset, -1, ENC_NA);
4113 /* Dissect Cisco OUI TLVs */
4114 static void
4115 dissect_cisco_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
4117 uint8_t subType;
4118 uint32_t offset = 0;
4119 unsigned length = tvb_reported_length(tvb);
4121 proto_tree *upoe_data = NULL;
4122 proto_item *tf = NULL;
4123 proto_item *parent_item = proto_tree_get_parent(tree);
4125 if (tree == NULL) return;
4127 /* Get subtype */
4128 subType = tvb_get_uint8(tvb, offset);
4130 proto_tree_add_item(tree, hf_cisco_subtype, tvb, offset, 1, ENC_BIG_ENDIAN);
4131 offset++;
4132 length--;
4134 switch (subType)
4136 /* UPOE */
4137 case 0x01:
4138 tf = proto_tree_add_item(tree, hf_cisco_upoe, tvb, offset, 1, ENC_BIG_ENDIAN);
4139 upoe_data = proto_item_add_subtree(tf, ett_cisco_upoe_tlv);
4140 proto_tree_add_item(upoe_data, hf_cisco_upoe_supported, tvb, offset, 1, ENC_BIG_ENDIAN);
4141 proto_tree_add_item(upoe_data, hf_cisco_upoe_altb_detection, tvb, offset, 1, ENC_BIG_ENDIAN);
4142 proto_tree_add_item(upoe_data, hf_cisco_upoe_req_spare_pair, tvb, offset, 1, ENC_BIG_ENDIAN);
4143 proto_tree_add_item(upoe_data, hf_cisco_upoe_pse_spare_pair_oper, tvb, offset, 1, ENC_BIG_ENDIAN);
4144 offset++;
4145 length--;
4146 break;
4147 /* ACI */
4148 case 0xc9: // 201 port-state, uint8
4149 tf = proto_tree_add_item(tree, hf_cisco_aci_portstate, tvb, offset, length, ENC_NA);
4150 proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
4151 offset++;
4152 length--;
4153 break;
4154 case 0xca: // 202 node-role, uint8
4155 tf = proto_tree_add_item(tree, hf_cisco_aci_noderole, tvb, offset, length, ENC_NA);
4156 proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
4157 offset++;
4158 length--;
4159 break;
4160 case 0xcb: // 203 node-id, uint32
4161 tf = proto_tree_add_item(tree, hf_cisco_aci_nodeid, tvb, offset, length, ENC_BIG_ENDIAN);
4162 proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
4163 offset += 4;
4164 length -= 4;
4165 break;
4166 case 0xcc: // 204 spine-level, uint8
4167 tf = proto_tree_add_item(tree, hf_cisco_aci_spinelevel, tvb, offset, length, ENC_NA);
4168 proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
4169 offset++;
4170 length--;
4171 break;
4172 case 0xcd: // 205 pod-id, uint16
4173 tf = proto_tree_add_item(tree, hf_cisco_aci_podid, tvb, offset, 2, ENC_BIG_ENDIAN);
4174 proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
4175 offset += 2;
4176 length -= 2;
4177 break;
4178 case 0xce: // 206 fabric-name, string
4179 tf = proto_tree_add_item(tree, hf_cisco_aci_fabricname, tvb, offset, length, ENC_ASCII);
4180 proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
4181 offset += length;
4182 length -= length;
4183 break;
4184 case 0xcf: // 207 av (id, ip, uuid) (uint8, ipv4, string)
4185 proto_tree_add_item(tree, hf_cisco_aci_apiclist, tvb, offset, length, ENC_NA);
4186 while (length > 0) {
4187 tf = proto_tree_add_item(tree, hf_cisco_aci_apicid, tvb, offset, 1, ENC_NA);
4188 proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
4189 offset++;
4190 length--;
4191 proto_tree_add_item(tree, hf_cisco_aci_apicipv4, tvb, offset, 4, ENC_NA);
4192 offset += 4;
4193 length -= 4;
4194 proto_tree_add_item(tree, hf_cisco_aci_apicuuid, tvb, offset, 36, ENC_ASCII);
4195 offset += 36;
4196 length -= 36;
4198 break;
4199 case 0xd0: // 208 node-ip, ipv4
4200 tf = proto_tree_add_item(tree, hf_cisco_aci_nodeip, tvb, offset, length, ENC_NA);
4201 proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
4202 offset += 4;
4203 length -= 4;
4204 break;
4205 case 0xd1: // 209 port-role, uint8
4206 tf = proto_tree_add_item(tree, hf_cisco_aci_portrole, tvb, offset, length, ENC_NA);
4207 proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
4208 offset++;
4209 length--;
4210 break;
4211 case 0xd2: // 210 fw-ver, string
4212 tf = proto_tree_add_item(tree, hf_cisco_aci_version, tvb, offset, length, ENC_ASCII);
4213 proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
4214 offset += length;
4215 length -= length;
4216 break;
4217 case 0xd3: // 211 infra-vlan, uint16
4218 tf = proto_tree_add_item(tree, hf_cisco_aci_fabricvlan, tvb, offset, 2, ENC_BIG_ENDIAN);
4219 proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
4220 offset += 2;
4221 length -= 2;
4222 break;
4223 case 0xd4: // 212 serial-number, string
4224 tf = proto_tree_add_item(tree, hf_cisco_aci_serialno, tvb, offset, length, ENC_ASCII);
4225 proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
4226 offset += length;
4227 length -= length;
4228 break;
4229 #if 0
4230 case 0xd5: // 213 unused
4231 break;
4232 #endif
4233 case 0xd6: // 214 model, string
4234 tf = proto_tree_add_item(tree, hf_cisco_aci_model, tvb, offset, length, ENC_ASCII);
4235 proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
4236 offset += length;
4237 length -= length;
4238 break;
4239 case 0xd7: // 215 name, string
4240 tf = proto_tree_add_item(tree, hf_cisco_aci_nodename, tvb, offset, length, ENC_ASCII);
4241 proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
4242 offset += length;
4243 length -= length;
4244 break;
4245 case 0xd8: // 216 port-mode, uint16
4246 tf = proto_tree_add_item(tree, hf_cisco_aci_portmode, tvb, offset, length, ENC_BIG_ENDIAN);
4247 proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
4248 offset += 2;
4249 length -= 2;
4250 break;
4251 case 0xd9: // 217 authenticate-cookie, bytes
4252 tf = proto_tree_add_item(tree, hf_cisco_aci_authcookie, tvb, offset, length, ENC_NA);
4253 proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
4254 offset += length;
4255 length -= length;
4256 break;
4257 case 0xda: // 218 standby-apic, uint8
4258 tf = proto_tree_add_item(tree, hf_cisco_aci_apicmode, tvb, offset, length, ENC_NA);
4259 proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
4260 offset++;
4261 length--;
4262 break;
4263 case 0xdb: // 219 fabric-id, uint16
4264 tf = proto_tree_add_item(tree, hf_cisco_aci_fabricid, tvb, offset, length, ENC_BIG_ENDIAN);
4265 proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
4266 offset += 2;
4267 length -= 2;
4268 break;
4269 default:
4270 if (length > 0) {
4271 proto_tree_add_item(tree, hf_unknown_subtype_content, tvb, offset, length, ENC_NA);
4272 offset += length;
4273 length -= length;
4275 break;
4277 if (length > 0) {
4278 proto_tree_add_item(tree, hf_subtype_content_remaining, tvb, offset, length, ENC_NA);
4282 /* Dissect OUI HytecGer-TLV's */
4283 static void
4284 dissect_hytec_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
4286 uint8_t subtype, group, identifier;
4287 int32_t bit_offset, msg_len, expected_data_length, maximum_data_length, temp_int32;
4288 proto_tree *hytec_data = NULL;
4289 proto_item *tf = NULL;
4290 proto_item *group_proto_item, *identifier_proto_item;
4291 float float_value = 0.0f;
4292 uint32_t offset = 0;
4294 subtype = tvb_get_uint8(tvb, offset);
4295 proto_tree_add_uint(tree, hf_hytec_tlv_subtype, tvb, offset, 1, subtype);
4296 offset++;
4298 /* get the group and identifier of the chosen subtype */
4299 bit_offset = (int32_t)(offset *8);
4300 group = tvb_get_bits8(tvb, bit_offset + HYTEC_GROUP_MASK_OFFSET, HYTEC_GROUP_MASK_SIZE);
4301 identifier = tvb_get_bits8(tvb, bit_offset + HYTEC_IDENTIFIER_MASK_OFFSET, HYTEC_IDENTIFIER_MASK_SIZE);
4303 group_proto_item = proto_tree_add_item(tree, hf_hytec_group, tvb, offset, 1, ENC_BIG_ENDIAN);
4304 identifier_proto_item = proto_tree_add_item(tree, hf_hytec_identifier, tvb, offset, 1, ENC_BIG_ENDIAN);
4305 proto_item_append_text(identifier_proto_item, " ("); /* a group dependent identifier description will be appended */
4307 offset++;
4308 msg_len = tvb_reported_length_remaining(tvb, offset);
4310 switch (subtype)
4312 case HYTEC_SUBTYPE__TRANSCEIVER: /* Transceiver-Subtype */
4313 proto_item_append_text(group_proto_item, " (%s)", val_to_str_const(group, hytec_transceiver_groups, "Unknown" ));
4315 switch (group)
4317 case HYTEC_TRANSG__TRANCEIVER_IDENTIFIER:
4318 proto_item_append_text(identifier_proto_item, "%s", val_to_str_const(identifier, hytec_tid, "Unknown"));
4320 switch (identifier)
4322 case HYTEC_TID__VENDOR_PRODUCT_REVISION:
4323 maximum_data_length = 64;
4324 if(0 < msg_len && msg_len <= maximum_data_length)
4325 proto_tree_add_item(tree, hf_hytec_transceiver_vendor_product_revision, tvb, offset, msg_len, ENC_ASCII);
4326 else
4327 { /* unexpected length */
4328 expert_add_info_format(pinfo, tree, &ei_lldp_bad_length, "%s length (%d) is beyond valid range (1-%d)", val_to_str_const(identifier, hytec_tid, ""), msg_len, maximum_data_length);
4329 if(msg_len) proto_tree_add_item(tree, hf_hytec_invalid_object_data, tvb, offset, msg_len, ENC_STR_HEX);
4331 break;
4332 default: proto_tree_add_item(tree, hf_hytec_unknown_identifier_content, tvb, offset, -1, ENC_NA); /* unknown identifier */
4333 } /* switch (identifier) */
4335 break;
4336 case HYTEC_TRANSG__TRANSCEIVER_BRIDGEABLE_DISTANCE:
4337 expected_data_length = 4;
4338 proto_item_append_text(identifier_proto_item, "%s", val_to_str_const(identifier, hytec_tbd, "Unknown"));
4340 switch (identifier)
4342 case HYTEC_TBD__SINGLE_MODE:
4343 if(msg_len == expected_data_length)
4345 proto_tree_add_item(tree, hf_hytec_single_mode, tvb, offset, msg_len, ENC_BIG_ENDIAN);
4347 else
4348 { /* unexpected length */
4349 expert_add_info_format(pinfo, tree, &ei_lldp_bad_length, "%s length (%d) != expected length (%d)", val_to_str_const(identifier, hytec_tbd, ""), msg_len, expected_data_length);
4350 if(msg_len) proto_tree_add_item(tree, hf_hytec_invalid_object_data, tvb, offset, msg_len, ENC_STR_HEX);
4352 break;
4353 case HYTEC_TBD__MULTI_MODE_50:
4354 if(msg_len == expected_data_length)
4356 proto_tree_add_item(tree, hf_hytec_multi_mode_50, tvb, offset, msg_len, ENC_BIG_ENDIAN);
4358 else
4359 { /* unexpected length */
4360 expert_add_info_format(pinfo, tree, &ei_lldp_bad_length, "%s length (%d) != expected length (%d)", val_to_str_const(identifier, hytec_tbd, ""), msg_len, expected_data_length);
4361 if(msg_len) proto_tree_add_item(tree, hf_hytec_invalid_object_data, tvb, offset, msg_len, ENC_STR_HEX);
4363 break;
4364 case HYTEC_TBD__MULTI_MODE_62_5:
4365 if(msg_len == expected_data_length)
4367 proto_tree_add_item(tree, hf_hytec_multi_mode_62_5, tvb, offset, msg_len, ENC_BIG_ENDIAN);
4369 else
4370 { /* unexpected length */
4371 expert_add_info_format(pinfo, tree, &ei_lldp_bad_length, "%s length (%d) != expected length (%d)", val_to_str_const(identifier, hytec_tbd, ""), msg_len, expected_data_length);
4372 if(msg_len) proto_tree_add_item(tree, hf_hytec_invalid_object_data, tvb, offset, msg_len, ENC_STR_HEX);
4374 break;
4375 default: proto_tree_add_item(tree, hf_hytec_unknown_identifier_content, tvb, offset, -1, ENC_NA); /* unknown identifier */
4376 } /* switch (identifier) */
4377 break;
4378 case HYTEC_TRANSG__MEASUREMENT_DATA:
4379 expected_data_length = 4;
4380 proto_item_append_text(identifier_proto_item, "%s", val_to_str_const(identifier, hytec_md, "Unknown"));
4382 switch (identifier)
4384 case HYTEC_MD__TX_CURRENT_OUTPUT_POWER:
4385 if(msg_len == expected_data_length)
4387 temp_int32 = tvb_get_ntohil(tvb, offset);
4388 float_value = (float) 0.1 * (float) temp_int32;
4389 proto_tree_add_float(tree, hf_hytec_tx_current_output_power, tvb, offset, msg_len, float_value);
4391 else
4392 { /* unexpected length */
4393 expert_add_info_format(pinfo, tree, &ei_lldp_bad_length, "%s length (%d) != expected length (%d)", val_to_str_const(identifier, hytec_md, ""), msg_len, expected_data_length);
4394 if(msg_len) proto_tree_add_item(tree, hf_hytec_invalid_object_data, tvb, offset, msg_len, ENC_STR_HEX);
4396 break;
4397 case HYTEC_MD__RX_CURRENT_INPUT_POWER:
4398 if(msg_len == expected_data_length)
4400 temp_int32 = tvb_get_ntohil(tvb, offset);
4401 float_value = (float) 0.1 * (float) temp_int32;
4402 proto_tree_add_float(tree, hf_hytec_rx_current_input_power, tvb, offset, msg_len, float_value);
4404 else
4405 { /* unexpected length */
4406 expert_add_info_format(pinfo, tree, &ei_lldp_bad_length, "%s length (%d) != expected length (%d)", val_to_str_const(identifier, hytec_md, ""), msg_len, expected_data_length);
4407 if(msg_len) proto_tree_add_item(tree, hf_hytec_invalid_object_data, tvb, offset, msg_len, ENC_STR_HEX);
4409 break;
4410 case HYTEC_MD__RX_INPUT_SNR:
4411 if(msg_len == expected_data_length)
4413 temp_int32 = tvb_get_ntohil(tvb, offset);
4414 if(temp_int32 < 0) float_value = (float)-1.0 * (float)((~temp_int32) >> 8);
4415 else float_value = (float) (temp_int32 >> 8);
4416 float_value += (float)(temp_int32 & 0xFF) * (float)0.00390625; /* 0.00390625 == 0.5 ^ 8 */
4417 proto_tree_add_float(tree, hf_hytec_rx_input_snr, tvb, offset, msg_len, float_value);
4419 else
4420 { /* unexpected length */
4421 expert_add_info_format(pinfo, tree, &ei_lldp_bad_length, "%s length (%d) != expected length (%d)", val_to_str_const(identifier, hytec_md, ""), msg_len, expected_data_length);
4422 if(msg_len) proto_tree_add_item(tree, hf_hytec_invalid_object_data, tvb, offset, msg_len, ENC_STR_HEX);
4424 break;
4425 case HYTEC_MD__LINELOSS:
4426 if(msg_len == expected_data_length)
4428 temp_int32 = tvb_get_ntohil(tvb, offset);
4429 if(temp_int32 < 0) float_value = (float)-1.0 * (float)((~temp_int32) >> 8);
4430 else float_value = (float) (temp_int32 >> 8);
4431 float_value += (float)(temp_int32 & 0xFF) * (float)0.00390625; /* 0.5 ^ 8 */
4432 proto_tree_add_float(tree, hf_hytec_lineloss, tvb, offset, msg_len, float_value);
4434 else
4435 { /* unexpected length */
4436 expert_add_info_format(pinfo, tree, &ei_lldp_bad_length, "%s length (%d) != expected length (%d)", val_to_str_const(identifier, hytec_md, ""), msg_len, expected_data_length);
4437 if(msg_len) proto_tree_add_item(tree, hf_hytec_invalid_object_data, tvb, offset, msg_len, ENC_STR_HEX);
4439 break;
4440 default: proto_tree_add_item(tree, hf_hytec_unknown_identifier_content, tvb, offset, -1, ENC_NA); /* unknown identifier */
4441 } /* switch (identifier) */
4442 break;
4443 default: /* unknown group */
4444 /* identifier considered also unknown */
4445 proto_item_append_text(identifier_proto_item, "Unknown");
4446 proto_tree_add_item(tree, hf_hytec_unknown_identifier_content, tvb, offset, -1, ENC_NA);
4447 } /* switch (group) */
4448 break;
4449 case HYTEC_SUBTYPE__TRACE: /* Trace-Subtype */
4450 proto_item_append_text(group_proto_item, " (%s)", val_to_str_const(group, hytec_trace_groups, "Unknown"));
4452 switch (group)
4454 case HYTEC_TRACEG__MAC_TRACE:
4455 proto_item_append_text(identifier_proto_item, "%s", val_to_str_const(identifier, hytec_mc, "Unknown"));
4457 switch (identifier)
4459 case HYTEC_MC__MAC_TRACE_REQUEST:
4460 expected_data_length = 13;
4461 if(msg_len == expected_data_length)
4463 tf = proto_tree_add_item(tree, hf_hytec_mac_trace_request, tvb, offset, -1, ENC_NA);
4464 hytec_data = proto_item_add_subtree(tf, ett_org_spc_hytec_trace_request);
4465 proto_tree_add_item(hytec_data, hf_hytec_trace_mac_address, tvb, offset, 6, ENC_NA);
4466 offset += 6;
4467 proto_tree_add_item(hytec_data, hf_hytec_request_mac_address, tvb, offset, 6, ENC_NA);
4468 offset += 6;
4469 proto_tree_add_item(hytec_data, hf_hytec_maximum_depth, tvb, offset, 1, ENC_BIG_ENDIAN);
4470 /*offset += 1;*/
4472 else
4473 { /* unexpected length */
4474 expert_add_info_format(pinfo, tree, &ei_lldp_bad_length, "%s length (%d) != expected length (%d)", val_to_str_const(identifier, hytec_mc, ""), msg_len, expected_data_length);
4475 if(msg_len) proto_tree_add_item(tree, hf_hytec_invalid_object_data, tvb, offset, msg_len, ENC_STR_HEX);
4477 break;
4478 case HYTEC_MC__MAC_TRACE_REPLY:
4479 expected_data_length = 13;
4480 if(msg_len == expected_data_length)
4482 tf = proto_tree_add_item(tree, hf_hytec_mac_trace_reply, tvb, offset, -1, ENC_NA);
4483 hytec_data = proto_item_add_subtree(tf, ett_org_spc_hytec_trace_reply);
4484 proto_tree_add_item(hytec_data, hf_hytec_trace_mac_address, tvb, offset, 6, ENC_NA);
4485 offset += 6;
4486 proto_tree_add_item(hytec_data, hf_hytec_answering_mac_address, tvb, offset, 6, ENC_NA);
4487 offset += 6;
4488 proto_tree_add_item(hytec_data, hf_hytec_actual_depth, tvb, offset, 1, ENC_BIG_ENDIAN);
4489 /*offset += 1;*/
4491 else
4492 { /* unexpected length */
4493 expert_add_info_format(pinfo, tree, &ei_lldp_bad_length, "%s length (%d) != expected length (%d)", val_to_str_const(identifier, hytec_mc, ""), msg_len, expected_data_length);
4494 if(msg_len) proto_tree_add_item(tree, hf_hytec_invalid_object_data, tvb, offset, msg_len, ENC_STR_HEX);
4496 break;
4497 case HYTEC_MC__NAME_OF_REPLYING_DEVICE:
4498 maximum_data_length = 64;
4499 if(0 < msg_len && msg_len <= maximum_data_length) proto_tree_add_item(tree, hf_hytec_name_of_replying_device, tvb, offset, msg_len, ENC_ASCII);
4500 else
4501 { /* unexpected length */
4502 expert_add_info_format(pinfo, tree, &ei_lldp_bad_length, "%s length (%d) is beyond valid range (1-%d)", val_to_str_const(identifier, hytec_mc, ""), msg_len, maximum_data_length);
4503 if(msg_len) proto_tree_add_item(tree, hf_hytec_invalid_object_data, tvb, offset, msg_len, ENC_STR_HEX);
4505 break;
4506 case HYTEC_MC__OUTGOING_PORT_NAME:
4507 maximum_data_length = 64;
4508 if(0 < msg_len && msg_len <= maximum_data_length) proto_tree_add_item(tree, hf_hytec_outgoing_port_name, tvb, offset, msg_len, ENC_ASCII);
4509 else
4510 { /* unexpected length */
4511 expert_add_info_format(pinfo, tree, &ei_lldp_bad_length, "%s length (%d) is beyond valid range (1-%d)", val_to_str_const(identifier, hytec_mc, ""), msg_len, maximum_data_length);
4512 if(msg_len) proto_tree_add_item(tree, hf_hytec_invalid_object_data, tvb, offset, msg_len, ENC_STR_HEX);
4514 break;
4515 case HYTEC_MC__IPV4_ADDRESS_OF_REPLYING_DEVICE:
4516 expected_data_length = 4;
4517 if(msg_len == expected_data_length) proto_tree_add_item(tree, hf_hytec_ipv4_address_of_replying_device, tvb, offset, msg_len, ENC_NA);
4518 else
4519 { /* unexpected length */
4520 expert_add_info_format(pinfo, tree, &ei_lldp_bad_length, "%s length (%d) != expected length (%d)", val_to_str_const(identifier, hytec_mc, ""), msg_len, expected_data_length);
4521 if(msg_len) proto_tree_add_item(tree, hf_hytec_invalid_object_data, tvb, offset, msg_len, ENC_STR_HEX);
4523 break;
4524 case HYTEC_MC__END_OF_TRACE:
4525 expected_data_length = 1;
4526 if(msg_len == expected_data_length) proto_tree_add_item(tree, hf_hytec_end_of_trace, tvb, offset, msg_len, ENC_BIG_ENDIAN);
4527 else
4528 { /* unexpected length */
4529 expert_add_info_format(pinfo, tree, &ei_lldp_bad_length, "%s length (%d) != expected length (%d)", val_to_str_const(identifier, hytec_mc, ""), msg_len, expected_data_length);
4530 if(msg_len) proto_tree_add_item(tree, hf_hytec_invalid_object_data, tvb, offset, msg_len, ENC_STR_HEX);
4532 break;
4533 case HYTEC_MC__IPV6_ADDRESS_OF_REPLYING_DEVICE:
4534 expected_data_length = 16;
4535 if(msg_len == expected_data_length) proto_tree_add_item(tree, hf_hytec_ipv6_address_of_replying_device, tvb, offset, msg_len, ENC_NA);
4536 else
4537 { /* unexpected length */
4538 expert_add_info_format(pinfo, tree, &ei_lldp_bad_length, "%s length (%d) != expected length (%d)", val_to_str_const(identifier, hytec_mc, ""), msg_len, expected_data_length);
4539 if(msg_len) proto_tree_add_item(tree, hf_hytec_invalid_object_data, tvb, offset, msg_len, ENC_STR_HEX);
4541 break;
4542 case HYTEC_MC__INCOMING_PORT_NAME:
4543 maximum_data_length = 64;
4544 if(0 < msg_len && msg_len <= maximum_data_length) proto_tree_add_item(tree, hf_hytec_incoming_port_name, tvb, offset, msg_len, ENC_ASCII);
4545 else
4546 { /* unexpected length */
4547 expert_add_info_format(pinfo, tree, &ei_lldp_bad_length, "%s length (%d) is beyond valid range (1-%d)", val_to_str_const(identifier, hytec_mc, ""), msg_len, maximum_data_length);
4548 if(msg_len) proto_tree_add_item(tree, hf_hytec_invalid_object_data, tvb, offset, msg_len, ENC_STR_HEX);
4550 break;
4551 case HYTEC_MC__TRACE_IDENTIFIER:
4552 expected_data_length = 4;
4553 if(msg_len == expected_data_length) proto_tree_add_item(tree, hf_hytec_trace_identifier, tvb, offset, msg_len, ENC_BIG_ENDIAN);
4554 else
4555 { /* unexpected length */
4556 expert_add_info_format(pinfo, tree, &ei_lldp_bad_length, "%s length (%d) != expected length (%d)", val_to_str_const(identifier, hytec_mc, ""), msg_len, expected_data_length);
4557 if(msg_len) proto_tree_add_item(tree, hf_hytec_invalid_object_data, tvb, offset, msg_len, ENC_STR_HEX);
4559 break;
4560 default: proto_tree_add_item(tree, hf_hytec_unknown_identifier_content, tvb, offset, -1, ENC_NA); /* unknown identifier */
4561 } /* switch (identifier) */
4562 break;
4563 default: /* unknown group */
4564 /* identifier considered also unknown */
4565 proto_item_append_text(identifier_proto_item, "Unknown");
4566 proto_tree_add_item(tree, hf_hytec_unknown_identifier_content, tvb, offset, -1, ENC_NA);
4567 } /* switch (group) */
4568 break;
4569 default: /* unknown subtype */
4570 proto_item_append_text(group_proto_item, " (Unknown)");
4571 proto_item_append_text(identifier_proto_item, "Unknown");
4572 proto_tree_add_item(tree, hf_unknown_subtype_content, tvb, offset, -1, ENC_NA);
4573 break;
4574 } /* switch (subtype) */
4576 proto_item_append_text(identifier_proto_item, ")");
4579 /* Dissect Avaya OUI TLVs */
4580 static void
4581 dissect_avaya_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
4583 uint8_t subType;
4584 uint32_t offset = 0;
4586 proto_tree *avaya_data = NULL;
4587 proto_item *tf = NULL;
4589 /* Get subtype */
4590 subType = tvb_get_uint8(tvb, offset);
4592 proto_tree_add_item(tree, hf_avaya_subtype, tvb, offset, 1, ENC_BIG_ENDIAN);
4594 offset++;
4596 switch (subType)
4598 case 0x01: /* PoE Conservation Level Support */
4600 proto_tree_add_item(tree, hf_avaya_poe, tvb, offset, 7, ENC_NA);
4601 break;
4603 case 0x03: /* Call Server IP Address */
4605 proto_tree_add_item(tree, hf_avaya_call_server, tvb, offset, 4, ENC_NA);
4606 break;
4608 case 0x04: /* IP Phone Addresses */
4610 tf = proto_tree_add_item(tree, hf_avaya_ipphone, tvb, offset, 12, ENC_NA);
4611 avaya_data = proto_item_add_subtree(tf, ett_avaya_ipphone_tlv);
4612 proto_tree_add_item(avaya_data, hf_avaya_ipphone_ip, tvb, offset, 4, ENC_NA);
4613 proto_tree_add_item(avaya_data, hf_avaya_ipphone_mask, tvb, offset+4, 4, ENC_NA);
4614 proto_tree_add_item(avaya_data, hf_avaya_ipphone_gateway, tvb, offset+8, 4, ENC_NA);
4615 break;
4617 case 0x05: /* CNA Server IP Address */
4619 proto_tree_add_item(tree, hf_avaya_cna_server, tvb, offset, 4, ENC_NA);
4620 break;
4622 case 0x06: /* File Server */
4624 proto_tree_add_item(tree, hf_avaya_file_server, tvb, offset, 4, ENC_NA);
4625 break;
4627 case 0x07: /* 802.1Q Framing */
4629 proto_tree_add_item(tree, hf_avaya_dot1q, tvb, offset, 1, ENC_NA);
4630 break;
4632 default:
4633 proto_tree_add_item(tree, hf_unknown_subtype_content, tvb, offset, -1, ENC_NA);
4634 break;
4638 /* Dissect IANA OUI TLVs */
4639 static void
4640 dissect_iana_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
4642 uint16_t msg_len;
4643 uint8_t subType;
4644 uint32_t offset = 0;
4646 /* Get subtype */
4647 subType = tvb_get_uint8(tvb, offset);
4649 proto_tree_add_item(tree, hf_iana_subtype, tvb, offset, 1, ENC_BIG_ENDIAN);
4650 offset++;
4652 msg_len=tvb_reported_length_remaining(tvb, offset);
4653 switch (subType)
4655 case 0x01: /* MUDURL */
4656 if ( msg_len > 0 )
4657 proto_tree_add_item(tree, hf_iana_mudurl, tvb, offset, msg_len, ENC_ASCII);
4658 break;
4660 default:
4661 proto_tree_add_item(tree, hf_unknown_subtype_content, tvb, offset, -1, ENC_NA);
4662 break;
4666 static void
4667 dissect_onos_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
4669 uint16_t msg_len;
4670 uint32_t subType;
4671 uint32_t offset = 0;
4673 proto_tree_add_item_ret_uint(tree, hf_onos_subtype, tvb, offset, 1, ENC_BIG_ENDIAN, &subType);
4674 offset++;
4676 msg_len=tvb_reported_length_remaining(tvb, offset);
4677 switch (subType)
4679 case ONOS_CHASSIS_TLV_TYPE:
4680 proto_tree_add_item(tree, hf_onos_chassis, tvb, offset, msg_len, ENC_ASCII);
4681 break;
4682 case ONOS_PORT_TLV_TYPE:
4683 proto_tree_add_item(tree, hf_onos_port, tvb, offset, msg_len, ENC_ASCII);
4684 break;
4685 case ONOS_TTL_TLV_TYPE:
4686 proto_tree_add_item(tree, hf_onos_ttl, tvb, offset, msg_len, ENC_NA);
4687 break;
4688 default:
4689 proto_tree_add_item(tree, hf_unknown_subtype_content, tvb, offset, -1, ENC_NA);
4690 break;
4695 /* Dissect Organizational Specific TLV */
4696 static int32_t
4697 dissect_organizational_specific_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint32_t offset, profinet_lldp_column_info *pn_lldp_column_info)
4699 uint16_t dataLen;
4700 uint16_t tempShort;
4701 int tempTree;
4702 uint32_t oui, tLength = tvb_reported_length(tvb);
4703 uint8_t subType;
4704 tvbuff_t *vendor_tvb;
4705 const char *ouiStr;
4706 const char *subTypeStr;
4708 proto_tree *org_tlv_tree = NULL;
4709 proto_item *lf = NULL;
4710 /* Get tlv type and length */
4711 tempShort = tvb_get_ntohs(tvb, offset);
4713 /* Get tlv length */
4714 dataLen = TLV_INFO_LEN(tempShort);
4715 /* Get OUI value */
4716 oui = tvb_get_ntoh24(tvb, (offset+2));
4717 subType = tvb_get_uint8(tvb, (offset+5));
4719 /* check for registered dissectors for the OUI If none found continue, else call dissector */
4720 if( dissector_try_uint(oui_unique_code_table, oui, tvb, pinfo, tree) ) {
4721 return tLength;
4723 /* Look in manuf database for OUI */
4724 ouiStr = uint_get_manuf_name_if_known(oui);
4725 if(ouiStr==NULL) ouiStr="Unknown";
4727 /* Set a default value */
4728 tempTree = ett_org_spc_ProfinetSubTypes_1;
4729 switch(oui)
4731 case OUI_DCBX:
4732 subTypeStr = val_to_str(subType, dcbx_protocol_types, "Unknown subtype (0x%x)");
4733 switch(subType)
4735 case 1: tempTree = ett_org_spc_dcbx_cin;
4736 break;
4737 case 2: tempTree = ett_org_spc_dcbx_cee;
4738 break;
4740 break;
4741 case OUI_IEEE_802_1:
4742 subTypeStr = val_to_str(subType, ieee_802_1_subtypes, "Unknown subtype 0x%x");
4743 switch(subType)
4745 case 0x1: tempTree = ett_org_spc_ieee_802_1_1;
4746 break;
4747 case 0x2: tempTree = ett_org_spc_ieee_802_1_2;
4748 break;
4749 case 0x3: tempTree = ett_org_spc_ieee_802_1_3;
4750 break;
4751 case 0x4: tempTree = ett_org_spc_ieee_802_1_4;
4752 break;
4753 case 0x8: tempTree = ett_org_spc_ieee_802_1_8;
4754 break;
4755 case 0x9: tempTree = ett_org_spc_ieee_802_1_9;
4756 break;
4757 case 0xa: tempTree = ett_org_spc_ieee_802_1_a;
4758 break;
4759 case 0xb: tempTree = ett_org_spc_ieee_802_1_b;
4760 break;
4761 case 0xc: tempTree = ett_org_spc_ieee_802_1_c;
4762 break;
4764 break;
4765 case OUI_IEEE_802_3:
4766 subTypeStr = val_to_str(subType, ieee_802_3_subtypes, "Unknown subtype 0x%x");
4767 switch(subType)
4769 case 1: tempTree = ett_org_spc_ieee_802_3_1;
4770 break;
4771 case 2: tempTree = ett_org_spc_ieee_802_3_2;
4772 break;
4773 case 3: tempTree = ett_org_spc_ieee_802_3_3;
4774 break;
4775 case 4: tempTree = ett_org_spc_ieee_802_3_4;
4776 break;
4777 case 5: tempTree = ett_org_spc_ieee_802_3_5;
4778 break;
4779 case 7: tempTree = ett_org_spc_ieee_802_3_7;
4780 break;
4782 break;
4783 case OUI_MEDIA_ENDPOINT:
4784 subTypeStr = val_to_str(subType, media_subtypes, "Unknown subtype 0x%x");
4785 switch(subType)
4787 case 1: tempTree = ett_org_spc_media_1;
4788 break;
4789 case 2: tempTree = ett_org_spc_media_2;
4790 break;
4791 case 3: tempTree = ett_org_spc_media_3;
4792 break;
4793 case 4: tempTree = ett_org_spc_media_4;
4794 break;
4795 case 5: tempTree = ett_org_spc_media_5;
4796 break;
4797 case 6: tempTree = ett_org_spc_media_6;
4798 break;
4799 case 7: tempTree = ett_org_spc_media_7;
4800 break;
4801 case 8: tempTree = ett_org_spc_media_8;
4802 break;
4803 case 9: tempTree = ett_org_spc_media_9;
4804 break;
4805 case 10: tempTree = ett_org_spc_media_10;
4806 break;
4807 case 11: tempTree = ett_org_spc_media_11;
4808 break;
4810 break;
4811 case OUI_PROFINET:
4812 subTypeStr = val_to_str(subType, profinet_subtypes, "Reserved (0x%x)");
4813 switch(subType)
4815 case 1: tempTree = ett_org_spc_ProfinetSubTypes_1;
4816 break;
4817 case 2: tempTree = ett_org_spc_ProfinetSubTypes_2;
4818 break;
4819 case 3: tempTree = ett_org_spc_ProfinetSubTypes_3;
4820 break;
4821 case 4: tempTree = ett_org_spc_ProfinetSubTypes_4;
4822 break;
4823 case 5: tempTree = ett_org_spc_ProfinetSubTypes_5;
4824 break;
4825 case 6: tempTree = ett_org_spc_ProfinetSubTypes_6;
4826 break;
4828 break;
4829 case OUI_CISCO_2:
4830 subTypeStr = val_to_str(subType, cisco_subtypes, "Unknown subtype (0x%x)");
4831 break;
4832 case OUI_IEEE_802_1QBG:
4833 subTypeStr = val_to_str(subType, ieee_802_1qbg_subtypes, "Unknown subtype 0x%x");
4834 break;
4835 case OUI_AVAYA_EXTREME:
4836 subTypeStr = val_to_str(subType, ex_avaya_subtypes, "Unknown subtype 0x%x");
4837 switch(subType)
4839 case EX_AVAYA_SUBTYPE_ELEMENT_TLV: tempTree = ett_ex_avayaSubTypes_11;
4840 break;
4841 case EX_AVAYA_SUBTYPE_ASSIGNMENT_TLV: tempTree = ett_ex_avayaSubTypes_12;
4842 break;
4844 break;
4845 case OUI_AVAYA_EXTREME2:
4846 subTypeStr = val_to_str(subType, ex_avaya2_subtypes, "Unknown subtype 0x%x");
4847 switch(subType)
4849 case EX_AVAYA2_SUBTYPE_ZTFv2_FC_TLV: tempTree = ett_ex_avaya2SubTypes_4;
4850 break;
4852 break;
4853 case OUI_HYTEC_GER:
4854 subTypeStr = val_to_str(subType, hytec_subtypes, "Unknown subtype (0x%x)");
4855 switch(subType)
4857 case HYTEC_SUBTYPE__TRANSCEIVER: tempTree = ett_org_spc_hytec_subtype_transceiver;
4858 break;
4859 case HYTEC_SUBTYPE__TRACE: tempTree = ett_org_spc_hytec_subtype_trace;
4860 break;
4862 break;
4863 case OUI_AVAYA:
4864 subTypeStr = val_to_str(subType, avaya_subtypes, "Unknown subtype (0x%x)");
4865 break;
4866 case OUI_IANA:
4867 subTypeStr = val_to_str(subType, iana_subtypes, "Unknown subtype (0x%x)");
4868 break;
4869 case OUI_ONOS:
4870 subTypeStr = val_to_str(subType, onos_subtypes, "Unknown subtype (0x%x)");
4871 break;
4872 case OUI_ODVA:
4873 subTypeStr = val_to_str(subType, lldp_cip_subtypes, "Unknown subtype (0x%x)");
4874 break;
4875 default:
4876 subTypeStr = wmem_strdup_printf(pinfo->pool, "Unknown (%d)",subType);
4877 break;
4880 org_tlv_tree = proto_tree_add_subtree_format(tree, tvb, offset, tLength, tempTree, NULL, "%s - %s", ouiStr, subTypeStr);
4881 proto_tree_add_item(org_tlv_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN);
4883 lf = proto_tree_add_item(org_tlv_tree, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN);
4884 if (dataLen < 4)
4886 expert_add_info_format(pinfo, lf, &ei_lldp_bad_length,
4887 "TLV length (%u) too short, must be >=4)", dataLen);
4888 return tLength;
4891 /* Display organizational unique id */
4892 proto_tree_add_uint(org_tlv_tree, hf_org_spc_oui, tvb, offset + 2, 3, oui);
4894 /* Try to make sure we don't overrun the sub-tlvs */
4895 vendor_tvb = tvb_new_subset_length(tvb, offset + 5, dataLen - 3);
4897 switch (oui)
4899 case OUI_DCBX:
4900 dissect_dcbx_tlv(vendor_tvb, pinfo, org_tlv_tree);
4901 break;
4902 case OUI_IEEE_802_1:
4903 dissect_ieee_802_1_tlv(vendor_tvb, pinfo, org_tlv_tree);
4904 break;
4905 case OUI_IEEE_802_3:
4906 dissect_ieee_802_3_tlv(vendor_tvb, pinfo, org_tlv_tree);
4907 break;
4908 case OUI_MEDIA_ENDPOINT:
4909 dissect_media_tlv(vendor_tvb, pinfo, org_tlv_tree);
4910 break;
4911 case OUI_PROFINET:
4912 dissect_profinet_tlv(vendor_tvb, pinfo, org_tlv_tree, pn_lldp_column_info);
4913 break;
4914 case OUI_CISCO_2:
4915 dissect_cisco_tlv(vendor_tvb, pinfo, org_tlv_tree);
4916 break;
4917 case OUI_IEEE_802_1QBG:
4918 dissect_ieee_802_1qbg_tlv(vendor_tvb, pinfo, org_tlv_tree);
4919 break;
4920 case OUI_HYTEC_GER:
4921 dissect_hytec_tlv(vendor_tvb, pinfo, org_tlv_tree);
4922 break;
4923 case OUI_AVAYA:
4924 dissect_avaya_tlv(vendor_tvb, pinfo, org_tlv_tree);
4925 break;
4926 case OUI_IANA:
4927 dissect_iana_tlv(vendor_tvb, pinfo, org_tlv_tree);
4928 break;
4929 case OUI_AVAYA_EXTREME:
4930 dissect_extreme_avaya_tlv(vendor_tvb, pinfo, org_tlv_tree, dataLen );
4931 break;
4932 case OUI_AVAYA_EXTREME2:
4933 dissect_extreme_avaya2_tlv(vendor_tvb, pinfo, org_tlv_tree);
4934 break;
4935 case OUI_ONOS:
4936 dissect_onos_tlv(vendor_tvb, pinfo, org_tlv_tree);
4937 break;
4938 case OUI_ODVA:
4939 dissect_lldp_cip_tlv(vendor_tvb, pinfo, org_tlv_tree);
4940 break;
4941 default:
4942 dissect_oui_default_tlv(vendor_tvb, pinfo, org_tlv_tree);
4945 return offset + tvb_reported_length(tvb);
4948 /* Dissect Unknown TLV */
4949 static int32_t
4950 dissect_lldp_unknown_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, uint32_t offset)
4952 uint16_t dataLen;
4953 uint16_t tempShort;
4955 proto_tree *unknown_tlv_tree;
4957 /* Get tlv type and length */
4958 tempShort = tvb_get_ntohs(tvb, offset);
4960 /* Get tlv length */
4961 dataLen = TLV_INFO_LEN(tempShort);
4963 unknown_tlv_tree = proto_tree_add_subtree(tree, tvb, offset, (dataLen + 2), ett_unknown_tlv, NULL, "Unknown TLV");
4965 proto_tree_add_item(unknown_tlv_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN);
4966 proto_tree_add_item(unknown_tlv_tree, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN);
4968 offset += 2;
4969 /* Adjust for unknown data */
4970 offset += dataLen;
4972 return offset;
4976 /* Dissect LLDP packets */
4977 static int
4978 dissect_lldp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
4980 proto_item *ti;
4981 proto_tree *lldp_tree = NULL;
4982 tvbuff_t *new_tvb = NULL;
4983 uint32_t offset = 0;
4984 uint16_t isShutdown;
4985 int32_t rtnValue = 0;
4986 uint16_t tempShort;
4987 uint8_t tlvType;
4988 uint32_t tvbLen;
4989 profinet_lldp_column_info *pn_lldp_column_info = NULL;
4990 col_set_str(pinfo->cinfo, COL_PROTOCOL, "LLDP");
4992 /* Clear the information column on summary display */
4993 col_clear(pinfo->cinfo, COL_INFO);
4995 ti = proto_tree_add_item(tree, proto_lldp, tvb, offset, -1, ENC_NA);
4996 lldp_tree = proto_item_add_subtree(ti, ett_lldp);
4998 // Maybe add an explicit field for the type of the destination mac address?
5000 // IEEE 802.1AB-2016, Table 7-2—Support for MAC addresses in different systems
5001 // Address | C-VLAN Bridge | S-VLAN Bridge | TPMR Bridge | End station
5002 // ------------------------------------------+---------------+----------------+---------------+-------------
5003 // 01-80-C2-00-00-0E Nearest bridge | Mandatory | Mandatory | Mandatory | Mandatory
5004 // 01-80-C2-00-00-03 Nearest non-TPMR bridge | Mandatory | Mandatory | Not permitted | Recommended
5005 // 01-80-C2-00-00-00 Nearest Customer Bridge | Mandatory | Not permitted | Not permitted | Recommended
5006 // Any other group MAC address | Permitted | Permitted | Permitted | Permitted
5007 // Any individual MAC address | Permitted | Permitted | Permitted | Permitted
5009 /* Get chassis id tlv */
5010 tempShort = tvb_get_ntohs(tvb, offset);
5011 new_tvb = tvb_new_subset_length(tvb, offset, TLV_INFO_LEN(tempShort)+2);
5013 /* allocation */
5014 pn_lldp_column_info = wmem_new0(pinfo->pool, profinet_lldp_column_info);
5016 rtnValue = dissect_lldp_chassis_id(new_tvb, pinfo, lldp_tree, 0, pn_lldp_column_info);
5017 if (rtnValue < 0)
5019 col_set_str(pinfo->cinfo, COL_INFO, "Invalid Chassis ID TLV");
5020 return tvb_captured_length(tvb);
5023 offset += rtnValue;
5025 /* Get port id tlv */
5026 tempShort = tvb_get_ntohs(tvb, offset);
5027 new_tvb = tvb_new_subset_length(tvb, offset, TLV_INFO_LEN(tempShort)+2);
5029 rtnValue = dissect_lldp_port_id(new_tvb, pinfo, lldp_tree, 0, pn_lldp_column_info);
5030 if (rtnValue < 0)
5032 col_set_str(pinfo->cinfo, COL_INFO, "Invalid Port ID TLV");
5033 return tvb_captured_length(tvb);
5036 offset += rtnValue;
5038 /* Get time to live tlv */
5039 tempShort = tvb_get_ntohs(tvb, offset);
5040 new_tvb = tvb_new_subset_length(tvb, offset, TLV_INFO_LEN(tempShort)+2);
5042 rtnValue = dissect_lldp_time_to_live(new_tvb, pinfo, lldp_tree, 0, &isShutdown);
5043 if (rtnValue < 0)
5045 col_set_str(pinfo->cinfo, COL_INFO, "Invalid Time-to-Live TLV");
5046 return tvb_captured_length(tvb);
5049 offset += rtnValue;
5051 tvbLen = tvb_captured_length(tvb);
5052 /* Dissect optional tlv info that contained in data packets */
5053 while (offset < tvbLen)
5055 tempShort = tvb_get_ntohs(tvb, offset);
5056 tlvType = TLV_TYPE(tempShort);
5057 /* pass single TLV to dissectors, Zero offset (point to front of tlv) */
5058 new_tvb = tvb_new_subset_length(tvb, offset, TLV_INFO_LEN(tempShort)+2);
5059 switch (tlvType)
5061 case CHASSIS_ID_TLV_TYPE:
5062 dissect_lldp_chassis_id(new_tvb, pinfo, lldp_tree, 0, pn_lldp_column_info);
5063 rtnValue = -1; /* Duplicate chassis id tlv */
5064 if (column_info_selection == DEFAULT_COLUMN_INFO)
5066 col_set_str(pinfo->cinfo, COL_INFO, "Duplicate Chassis ID TLV");
5068 break;
5069 case PORT_ID_TLV_TYPE:
5070 dissect_lldp_port_id(new_tvb, pinfo, lldp_tree, 0, pn_lldp_column_info);
5071 rtnValue = -1; /* Duplicate port id tlv */
5072 if (column_info_selection == DEFAULT_COLUMN_INFO)
5074 col_set_str(pinfo->cinfo, COL_INFO, "Duplicate Port ID TLV");
5076 break;
5077 case TIME_TO_LIVE_TLV_TYPE:
5078 dissect_lldp_time_to_live(new_tvb, pinfo, lldp_tree, 0, &isShutdown);
5079 rtnValue = -1; /* Duplicate time-to-live tlv */
5080 if (column_info_selection == DEFAULT_COLUMN_INFO)
5082 col_set_str(pinfo->cinfo, COL_INFO, "Duplicate Time-To-Live TLV");
5084 break;
5085 case END_OF_LLDPDU_TLV_TYPE:
5086 rtnValue = dissect_lldp_end_of_lldpdu(new_tvb, pinfo, lldp_tree, 0);
5087 break;
5088 case PORT_DESCRIPTION_TLV_TYPE:
5089 rtnValue = dissect_lldp_port_desc(new_tvb, pinfo, lldp_tree, 0);
5090 break;
5091 case SYSTEM_NAME_TLV_TYPE:
5092 case SYSTEM_DESCRIPTION_TLV_TYPE:
5093 rtnValue = dissect_lldp_system_name(new_tvb, pinfo, lldp_tree, 0);
5094 break;
5095 case SYSTEM_CAPABILITIES_TLV_TYPE:
5096 rtnValue = dissect_lldp_system_capabilities(new_tvb, pinfo, lldp_tree, 0);
5097 break;
5098 case MANAGEMENT_ADDR_TLV_TYPE:
5099 rtnValue = dissect_lldp_management_address(new_tvb, pinfo, lldp_tree, 0);
5100 break;
5101 case ORGANIZATION_SPECIFIC_TLV_TYPE:
5102 rtnValue = dissect_organizational_specific_tlv(new_tvb, pinfo, lldp_tree, 0, pn_lldp_column_info);
5103 break;
5104 default:
5105 if (!assume_unrecognized_tlv
5106 || tempShort > tvb_reported_length_remaining(tvb, offset)) {
5107 /* Probably not an LLDP LTV */
5108 rtnValue = -1;
5110 else {
5111 rtnValue = dissect_lldp_unknown_tlv(new_tvb, pinfo, lldp_tree, 0);
5113 break;
5116 // Shutdown PDU: Verify that only ChassisID, PortID, TTL and optionally END TLVs are present
5117 if (isShutdown && tlvType != END_OF_LLDPDU_TLV_TYPE)
5119 proto_tree_add_expert_format(tree, pinfo, &ei_lldp_shutdown_excess_tlv , tvb, offset, TLV_INFO_LEN(tempShort),
5120 "TLV type 0x%02X not allowed in Shutdown PDU", tlvType);
5123 if (rtnValue < 0) {
5124 break;
5126 else
5127 offset += rtnValue;
5129 /* Terminate the LLDP dissector after reaching the END_OF_LLDPDU */
5130 if (tlvType == END_OF_LLDPDU_TLV_TYPE) {
5131 break;
5135 set_actual_length(tvb, offset);
5136 proto_item_set_len(ti, offset);
5137 return tvb_captured_length(tvb);
5140 /* Register the protocol with Wireshark */
5141 void
5142 proto_register_lldp(void)
5144 module_t *lldp_module;
5145 expert_module_t *expert_lldp;
5147 /* Setup list of header fields */
5148 static hf_register_info hf[] = {
5149 { &hf_lldp_tlv_type,
5150 { "TLV Type", "lldp.tlv.type", FT_UINT16, BASE_DEC,
5151 VALS(tlv_types), TLV_TYPE_MASK, NULL, HFILL }
5153 { &hf_lldp_tlv_len,
5154 { "TLV Length", "lldp.tlv.len", FT_UINT16, BASE_DEC,
5155 NULL, TLV_INFO_LEN_MASK, NULL, HFILL }
5157 { &hf_lldp_tlv_system_cap,
5158 { "Capabilities", "lldp.tlv.system_cap", FT_UINT16, BASE_HEX,
5159 NULL, 0, NULL, HFILL }
5161 { &hf_lldp_tlv_system_cap_other,
5162 { "Other", "lldp.tlv.system_cap.other", FT_BOOLEAN, 16,
5163 TFS(&tfs_capable_not_capable), SYSTEM_CAPABILITY_OTHER, NULL, HFILL }
5165 { &hf_lldp_tlv_system_cap_repeater,
5166 { "Repeater", "lldp.tlv.system_cap.repeater", FT_BOOLEAN, 16,
5167 TFS(&tfs_capable_not_capable), SYSTEM_CAPABILITY_REPEATER, NULL, HFILL }
5169 { &hf_lldp_tlv_system_cap_bridge,
5170 { "Bridge", "lldp.tlv.system_cap.bridge", FT_BOOLEAN, 16,
5171 TFS(&tfs_capable_not_capable), SYSTEM_CAPABILITY_BRIDGE, NULL, HFILL }
5173 { &hf_lldp_tlv_system_cap_wlan_access_pt,
5174 { "WLAN access point", "lldp.tlv.system_cap.wlan_access_pt", FT_BOOLEAN, 16,
5175 TFS(&tfs_capable_not_capable), SYSTEM_CAPABILITY_WLAN, NULL, HFILL }
5177 { &hf_lldp_tlv_system_cap_router,
5178 { "Router", "lldp.tlv.system_cap.router", FT_BOOLEAN, 16,
5179 TFS(&tfs_capable_not_capable), SYSTEM_CAPABILITY_ROUTER, NULL, HFILL }
5181 { &hf_lldp_tlv_system_cap_telephone,
5182 { "Telephone", "lldp.tlv.system_cap.telephone", FT_BOOLEAN, 16,
5183 TFS(&tfs_capable_not_capable), SYSTEM_CAPABILITY_TELEPHONE, NULL, HFILL }
5185 { &hf_lldp_tlv_system_cap_docsis_cable_device,
5186 { "DOCSIS cable device", "lldp.tlv.system_cap.docsis_cable_device", FT_BOOLEAN, 16,
5187 TFS(&tfs_capable_not_capable), SYSTEM_CAPABILITY_DOCSIS, NULL, HFILL }
5189 { &hf_lldp_tlv_system_cap_station_only,
5190 { "Station only", "lldp.tlv.system_cap.station_only", FT_BOOLEAN, 16,
5191 TFS(&tfs_capable_not_capable), SYSTEM_CAPABILITY_STATION, NULL, HFILL }
5193 { &hf_lldp_tlv_system_cap_cvlan_component,
5194 { "C-VLAN component", "lldp.tlv.system_cap.cvlan", FT_BOOLEAN, 16,
5195 TFS(&tfs_capable_not_capable), SYSTEM_CAPABILITY_CVLAN, NULL, HFILL }
5197 { &hf_lldp_tlv_system_cap_svlan_component,
5198 { "S-VLAN component", "lldp.tlv.system_cap.svlan", FT_BOOLEAN, 16,
5199 TFS(&tfs_capable_not_capable), SYSTEM_CAPABILITY_SVLAN, NULL, HFILL }
5201 { &hf_lldp_tlv_system_cap_tpmr_component,
5202 { "TPMR component", "lldp.tlv.system_cap.tpmr", FT_BOOLEAN, 16,
5203 TFS(&tfs_capable_not_capable), SYSTEM_CAPABILITY_TPMR, NULL, HFILL }
5205 { &hf_lldp_tlv_system_name,
5206 { "System Name", "lldp.tlv.system.name", FT_STRING, BASE_NONE,
5207 NULL, 0, NULL, HFILL }
5209 { &hf_lldp_tlv_system_desc,
5210 { "System Description", "lldp.tlv.system.desc", FT_STRING, BASE_NONE,
5211 NULL, 0, NULL, HFILL }
5213 { &hf_lldp_tlv_enable_system_cap,
5214 { "Enabled Capabilities", "lldp.tlv.enable_system_cap", FT_UINT16, BASE_HEX,
5215 NULL, 0, NULL, HFILL }
5217 { &hf_lldp_tlv_enable_system_cap_other,
5218 { "Other", "lldp.tlv.enable_system_cap.other", FT_BOOLEAN, 16,
5219 TFS(&tfs_capable_not_capable), SYSTEM_CAPABILITY_OTHER, NULL, HFILL }
5221 { &hf_lldp_tlv_enable_system_cap_repeater,
5222 { "Repeater", "lldp.tlv.enable_system_cap.repeater", FT_BOOLEAN, 16,
5223 TFS(&tfs_capable_not_capable), SYSTEM_CAPABILITY_REPEATER, NULL, HFILL }
5225 { &hf_lldp_tlv_enable_system_cap_bridge,
5226 { "Bridge", "lldp.tlv.enable_system_cap.bridge", FT_BOOLEAN, 16,
5227 TFS(&tfs_capable_not_capable), SYSTEM_CAPABILITY_BRIDGE, NULL, HFILL }
5229 { &hf_lldp_tlv_enable_system_cap_wlan_access_pt,
5230 { "WLAN access point", "lldp.tlv.enable_system_cap.wlan_access_pt", FT_BOOLEAN, 16,
5231 TFS(&tfs_capable_not_capable), SYSTEM_CAPABILITY_WLAN, NULL, HFILL }
5233 { &hf_lldp_tlv_enable_system_cap_router,
5234 { "Router", "lldp.tlv.enable_system_cap.router", FT_BOOLEAN, 16,
5235 TFS(&tfs_capable_not_capable), SYSTEM_CAPABILITY_ROUTER, NULL, HFILL }
5237 { &hf_lldp_tlv_enable_system_cap_telephone,
5238 { "Telephone", "lldp.tlv.enable_system_cap.telephone", FT_BOOLEAN, 16,
5239 TFS(&tfs_capable_not_capable), SYSTEM_CAPABILITY_TELEPHONE, NULL, HFILL }
5241 { &hf_lldp_tlv_enable_system_cap_docsis_cable_device,
5242 { "DOCSIS cable device", "lldp.tlv.enable_system_cap.docsis_cable_device", FT_BOOLEAN, 16,
5243 TFS(&tfs_capable_not_capable), SYSTEM_CAPABILITY_DOCSIS, NULL, HFILL }
5245 { &hf_lldp_tlv_enable_system_cap_station_only,
5246 { "Station only", "lldp.tlv.enable_system_cap.station_only", FT_BOOLEAN, 16,
5247 TFS(&tfs_capable_not_capable), SYSTEM_CAPABILITY_STATION, NULL, HFILL }
5249 { &hf_lldp_tlv_enable_system_cap_cvlan_component,
5250 { "C-VLAN component", "lldp.tlv.enable_system_cap.cvlan", FT_BOOLEAN, 16,
5251 TFS(&tfs_capable_not_capable), SYSTEM_CAPABILITY_CVLAN, NULL, HFILL }
5253 { &hf_lldp_tlv_enable_system_cap_svlan_component,
5254 { "S-VLAN component", "lldp.tlv.enable_system_cap.svlan", FT_BOOLEAN, 16,
5255 TFS(&tfs_capable_not_capable), SYSTEM_CAPABILITY_SVLAN, NULL, HFILL }
5257 { &hf_lldp_tlv_enable_system_cap_tpmr_component,
5258 { "TPMR component", "lldp.tlv.enable_system_cap.tpmr", FT_BOOLEAN, 16,
5259 TFS(&tfs_capable_not_capable), SYSTEM_CAPABILITY_TPMR, NULL, HFILL }
5261 { &hf_chassis_id_subtype,
5262 { "Chassis Id Subtype", "lldp.chassis.subtype", FT_UINT8, BASE_DEC,
5263 VALS(chassis_id_subtypes), 0, NULL, HFILL }
5265 { &hf_chassis_id,
5266 { "Chassis Id", "lldp.chassis.id", FT_BYTES, BASE_NONE,
5267 NULL, 0, NULL, HFILL }
5269 { &hf_chassis_id_mac,
5270 { "Chassis Id", "lldp.chassis.id.mac", FT_ETHER, BASE_NONE,
5271 NULL, 0, NULL, HFILL }
5273 { &hf_chassis_id_ip4,
5274 { "Chassis Id", "lldp.chassis.id.ip4", FT_IPv4, BASE_NONE,
5275 NULL, 0, NULL, HFILL }
5277 { &hf_chassis_id_ip6,
5278 { "Chassis Id", "lldp.chassis.id.ip6", FT_IPv6, BASE_NONE,
5279 NULL, 0, NULL, HFILL }
5281 { &hf_port_id_subtype,
5282 { "Port Id Subtype", "lldp.port.subtype", FT_UINT8, BASE_DEC,
5283 VALS(port_id_subtypes), 0, NULL, HFILL }
5285 { &hf_port_id,
5286 { "Port Id", "lldp.port.id", FT_STRING, BASE_NONE,
5287 NULL, 0, NULL, HFILL }
5289 { &hf_port_desc,
5290 { "Port Description", "lldp.port.desc", FT_STRING, BASE_NONE,
5291 NULL, 0, NULL, HFILL }
5293 { &hf_port_id_mac,
5294 { "Port Id", "lldp.port.id.mac", FT_ETHER, BASE_NONE,
5295 NULL, 0, NULL, HFILL }
5297 { &hf_lldp_network_address_family,
5298 { "Network Address family", "lldp.network_address.subtype", FT_UINT8, BASE_DEC,
5299 VALS(afn_vals), 0, NULL, HFILL }
5301 { &hf_port_id_ip4,
5302 { "Port Id", "lldp.port.id.ip4", FT_IPv4, BASE_NONE,
5303 NULL, 0, NULL, HFILL }
5305 { &hf_port_id_ip6,
5306 { "Port Id", "lldp.port.id.ip6", FT_IPv6, BASE_NONE,
5307 NULL, 0, NULL, HFILL }
5309 { &hf_time_to_live,
5310 { "Seconds", "lldp.time_to_live", FT_UINT16, BASE_DEC,
5311 NULL, 0, NULL, HFILL }
5313 { &hf_pdu_type,
5314 { "PDU Type", "lldp.pdu_type", FT_NONE, BASE_NONE,
5315 NULL, 0, NULL, HFILL }
5318 { &hf_mgn_address_len,
5319 { "Address String Length", "lldp.mgn.address.len", FT_UINT8, BASE_DEC,
5320 NULL, 0, NULL, HFILL }
5322 { &hf_mgn_address_subtype,
5323 { "Address Subtype", "lldp.mgn.address.subtype", FT_UINT8, BASE_DEC,
5324 VALS(afn_vals), 0, "Undefined", HFILL }
5326 { &hf_mgn_addr_ipv4,
5327 { "Management Address", "lldp.mgn.addr.ip4", FT_IPv4, BASE_NONE,
5328 NULL, 0, NULL, HFILL }
5330 { &hf_mgn_addr_ipv6,
5331 { "Management Address", "lldp.mgn.addr.ip6", FT_IPv6, BASE_NONE,
5332 NULL, 0, NULL, HFILL }
5334 { &hf_mgn_addr_hex,
5335 { "Management Address", "lldp.mgn.addr.hex", FT_BYTES, BASE_NONE,
5336 NULL, 0, NULL, HFILL }
5338 { &hf_mgn_interface_subtype,
5339 { "Interface Subtype", "lldp.mgn.interface.subtype", FT_UINT8, BASE_DEC,
5340 VALS(interface_subtype_values), 0, "Undefined", HFILL }
5342 { &hf_mgn_interface_number,
5343 { "Interface Number", "lldp.mgn.interface.number", FT_UINT32, BASE_DEC,
5344 NULL, 0, NULL, HFILL }
5346 { &hf_mgn_oid_len,
5347 { "OID String Length", "lldp.mgn.obj.len", FT_UINT8, BASE_DEC,
5348 NULL, 0, NULL, HFILL }
5350 { &hf_mgn_obj_id,
5351 { "Object Identifier", "lldp.mgn.obj.id", FT_OID, BASE_NONE,
5352 NULL, 0, NULL, HFILL }
5354 { &hf_org_spc_oui,
5355 { "Organization Unique Code", "lldp.orgtlv.oui", FT_UINT24, BASE_OUI,
5356 NULL, 0x0, NULL, HFILL }
5358 { &hf_dcbx_type,
5359 { "DCBx Protocol", "lldp.dcbx.proto", FT_UINT8, BASE_HEX,
5360 VALS(dcbx_protocol_types), 0x0, NULL, HFILL }
5362 { &hf_dcbx_tlv_type,
5363 { "DCBx TLV Type", "lldp.dcbx.type", FT_UINT16, BASE_DEC,
5364 VALS(dcbx_subtypes), TLV_TYPE_MASK, NULL, HFILL }
5366 { &hf_dcbx_tlv_len,
5367 { "DCBx TLV Length", "lldp.dcbx.len", FT_UINT16, BASE_DEC,
5368 NULL, TLV_INFO_LEN_MASK, NULL, HFILL }
5370 { &hf_dcbx_tlv_oper_version,
5371 { "Operating Version", "lldp.dcbx.version", FT_UINT8, BASE_HEX,
5372 VALS(dcbx_protocol_types), 0x0, "Unknown", HFILL }
5374 { &hf_dcbx_tlv_max_version,
5375 { "Max Version", "lldp.dcbx.max_version", FT_UINT8, BASE_HEX,
5376 VALS(dcbx_protocol_types), 0x0, "Unknown", HFILL }
5378 { &hf_dcbx_control_sequence,
5379 { "Sequence No", "lldp.dcbx.control.seq", FT_UINT32, BASE_DEC,
5380 NULL, 0, NULL, HFILL }
5382 { &hf_dcbx_control_ack,
5383 { "Ack No", "lldp.dcbx.control.ack", FT_UINT32, BASE_DEC,
5384 NULL, 0, NULL, HFILL }
5386 { &hf_dcbx_feature_flag_enabled,
5387 { "Feature", "lldp.dcbx.feature.enabled", FT_BOOLEAN , 8,
5388 TFS(&tfs_enabled_disabled), 0x80, NULL, HFILL }
5390 { &hf_dcbx_feature_flag_willing,
5391 { "Willing", "lldp.dcbx.feature.willing", FT_BOOLEAN , 8,
5392 TFS(&tfs_yes_no), 0x40, NULL, HFILL }
5394 { &hf_dcbx_feature_flag_error,
5395 { "Error", "lldp.dcbx.feature.error", FT_BOOLEAN , 8,
5396 TFS(&tfs_set_notset), 0x20, NULL, HFILL }
5398 { &hf_dcbx_feature_subtype,
5399 { "Subtype", "lldp.dcbx.feature.subtype", FT_UINT8, BASE_HEX,
5400 NULL, 0, NULL, HFILL }
5402 { &hf_dcbx_feature_pgid_reserved,
5403 { "Reserved", "lldp.dcbx.feature.pg.reserved", FT_UINT8, BASE_HEX,
5404 NULL, 0xFE, NULL, HFILL }
5406 { &hf_dcbx_feature_pgid_prio_0,
5407 { "PGID for Prio 0", "lldp.dcbx.feature.pg.pgid_prio0", FT_UINT16, BASE_DEC,
5408 NULL, 0xF000, NULL, HFILL }
5410 { &hf_dcbx_feature_pgid_prio_1,
5411 { "PGID for Prio 1", "lldp.dcbx.feature.pg.pgid_prio1", FT_UINT16, BASE_DEC,
5412 NULL, 0x0F00, NULL, HFILL }
5414 { &hf_dcbx_feature_pgid_prio_2,
5415 { "PGID for Prio 2", "lldp.dcbx.feature.pg.pgid_prio2", FT_UINT16, BASE_DEC,
5416 NULL, 0x00F0, NULL, HFILL }
5418 { &hf_dcbx_feature_pgid_prio_3,
5419 { "PGID for Prio 3", "lldp.dcbx.feature.pg.pgid_prio3", FT_UINT16, BASE_DEC,
5420 NULL, 0x000F, NULL, HFILL }
5422 { &hf_dcbx_feature_pgid_prio_4,
5423 { "PGID for Prio 4", "lldp.dcbx.feature.pg.pgid_prio4", FT_UINT16, BASE_DEC,
5424 NULL, 0xF000, NULL, HFILL }
5426 { &hf_dcbx_feature_pgid_prio_5,
5427 { "PGID for Prio 5", "lldp.dcbx.feature.pg.pgid_prio5", FT_UINT16, BASE_DEC,
5428 NULL, 0x0F00, NULL, HFILL }
5430 { &hf_dcbx_feature_pgid_prio_6,
5431 { "PGID for Prio 6", "lldp.dcbx.feature.pg.pgid_prio6", FT_UINT16, BASE_DEC,
5432 NULL, 0x00F0, NULL, HFILL }
5434 { &hf_dcbx_feature_pgid_prio_7,
5435 { "PGID for Prio 7", "lldp.dcbx.feature.pg.pgid_prio7", FT_UINT16, BASE_DEC,
5436 NULL, 0x000F, NULL, HFILL }
5438 { &hf_dcbx_feature_pg_per_0,
5439 { "Bandwidth for PGID 0", "lldp.dcbx.feature.pg.per0", FT_UINT8, BASE_DEC,
5440 NULL, 0, NULL, HFILL }
5442 { &hf_dcbx_feature_pg_per_1,
5443 { "Bandwidth for PGID 1", "lldp.dcbx.feature.pg.per1", FT_UINT8, BASE_DEC,
5444 NULL, 0, NULL, HFILL }
5446 { &hf_dcbx_feature_pg_per_2,
5447 { "Bandwidth for PGID 2", "lldp.dcbx.feature.pg.per2", FT_UINT8, BASE_DEC,
5448 NULL, 0, NULL, HFILL }
5450 { &hf_dcbx_feature_pg_per_3,
5451 { "Bandwidth for PGID 3", "lldp.dcbx.feature.pg.per3", FT_UINT8, BASE_DEC,
5452 NULL, 0, NULL, HFILL }
5454 { &hf_dcbx_feature_pg_per_4,
5455 { "Bandwidth for PGID 4", "lldp.dcbx.feature.pg.per4", FT_UINT8, BASE_DEC,
5456 NULL, 0, NULL, HFILL }
5458 { &hf_dcbx_feature_pg_per_5,
5459 { "Bandwidth for PGID 5", "lldp.dcbx.feature.pg.per5", FT_UINT8, BASE_DEC,
5460 NULL, 0, NULL, HFILL }
5462 { &hf_dcbx_feature_pg_per_6,
5463 { "Bandwidth for PGID 6", "lldp.dcbx.feature.pg.per6", FT_UINT8, BASE_DEC,
5464 NULL, 0, NULL, HFILL }
5466 { &hf_dcbx_feature_pg_per_7,
5467 { "Bandwidth for PGID 7", "lldp.dcbx.feature.pg.per7", FT_UINT8, BASE_DEC,
5468 NULL, 0, NULL, HFILL }
5470 { &hf_dcbx_feature_pg_numtcs,
5471 { "Number of Traffic Classes Supported", "lldp.dcbx.feature.pg.numtcs", FT_UINT8, BASE_HEX,
5472 NULL, 0, NULL, HFILL }
5474 { &hf_dcbx_feature_pfc_prio0,
5475 { "PFC for Priority 0", "lldp.dcbx.feature.pfc.prio0", FT_BOOLEAN, 8,
5476 TFS(&tfs_enabled_disabled), 0x1, NULL, HFILL }
5478 { &hf_dcbx_feature_pfc_prio1,
5479 { "PFC for Priority 1", "lldp.dcbx.feature.pfc.prio1", FT_BOOLEAN, 8,
5480 TFS(&tfs_enabled_disabled), 0x2, NULL, HFILL }
5482 { &hf_dcbx_feature_pfc_prio2,
5483 { "PFC for Priority 2", "lldp.dcbx.feature.pfc.prio2", FT_BOOLEAN, 8,
5484 TFS(&tfs_enabled_disabled), 0x4, NULL, HFILL }
5486 { &hf_dcbx_feature_pfc_prio3,
5487 { "PFC for Priority 3", "lldp.dcbx.feature.pfc.prio3", FT_BOOLEAN, 8,
5488 TFS(&tfs_enabled_disabled), 0x8, NULL, HFILL }
5490 { &hf_dcbx_feature_pfc_prio4,
5491 { "PFC for Priority 4", "lldp.dcbx.feature.pfc.prio4", FT_BOOLEAN, 8,
5492 TFS(&tfs_enabled_disabled), 0x10, NULL, HFILL }
5494 { &hf_dcbx_feature_pfc_prio5,
5495 { "PFC for Priority 5", "lldp.dcbx.feature.pfc.prio5", FT_BOOLEAN, 8,
5496 TFS(&tfs_enabled_disabled), 0x20, NULL, HFILL }
5498 { &hf_dcbx_feature_pfc_prio6,
5499 { "PFC for Priority 6", "lldp.dcbx.feature.pfc.prio6", FT_BOOLEAN, 8,
5500 TFS(&tfs_enabled_disabled), 0x40, NULL, HFILL }
5502 { &hf_dcbx_feature_pfc_prio7,
5503 { "PFC for Priority 7", "lldp.dcbx.feature.pfc.prio7", FT_BOOLEAN, 8,
5504 TFS(&tfs_enabled_disabled), 0x80, NULL, HFILL }
5506 { &hf_dcbx_feature_pfc_numtcs,
5507 { "Number of Traffic Classes Supported", "lldp.dcbx.feature.pfc.numtcs", FT_UINT8, BASE_HEX,
5508 NULL, 0, NULL, HFILL }
5510 { &hf_dcbx_feature_app_proto,
5511 { "Application Protocol Id", "lldp.dcbx.feature.app.proto", FT_UINT16, BASE_HEX,
5512 NULL, 0, NULL, HFILL }
5514 { &hf_dcbx_feature_app_selector,
5515 { "Selector Field", "lldp.dcbx.feature.app.sf", FT_UINT24, BASE_DEC,
5516 VALS(dcbx_app_selector), 0x3 << 16, NULL, HFILL }
5518 { &hf_dcbx_feature_app_oui,
5519 { "Application OUI", "lldp.dcbx.feature.app.oui", FT_UINT24, BASE_HEX,
5520 NULL, ~(0x3 << 16), NULL, HFILL }
5522 { &hf_dcbx_feature_app_prio,
5523 { "Application Priority", "lldp.dcbx.feature.app.prio", FT_UINT8, BASE_DEC,
5524 NULL, 0x0, NULL, HFILL }
5526 { &hf_dcbx_feature_flag_llink_type,
5527 { "Logical Link Down Type", "lldp.dcbx.feature.llink.type", FT_UINT8, BASE_HEX,
5528 VALS(dcbx_llink_types), 0x80, NULL, HFILL }
5530 { &hf_ieee_802_1_subtype,
5531 { "IEEE 802.1 Subtype", "lldp.ieee.802_1.subtype", FT_UINT8, BASE_HEX,
5532 VALS(ieee_802_1_subtypes), 0x0, NULL, HFILL }
5534 { &hf_ieee_802_1_port_and_vlan_id_flag,
5535 { "Flags", "lldp.ieee.802_1.port_and_vlan_id_flag", FT_UINT8, BASE_HEX,
5536 NULL, 0x0, NULL, HFILL }
5538 { &hf_ieee_802_1_port_and_vlan_id_flag_supported,
5539 { "Port and Protocol VLAN", "lldp.ieee.802_1.port_and_vlan_id_flag.supported", FT_BOOLEAN, 8,
5540 TFS(&tfs_supported_not_supported), 0x02, NULL, HFILL }
5542 { &hf_ieee_802_1_port_and_vlan_id_flag_enabled,
5543 { "Port and Protocol VLAN", "lldp.ieee.802_1.port_and_vlan_id_flag.enabled", FT_BOOLEAN, 8,
5544 TFS(&tfs_enabled_disabled), 0x04, NULL, HFILL }
5546 { &hf_ieee_802_1_port_vlan_id,
5547 { "Port VLAN Identifier", "lldp.ieee.802_1.port_vlan.id", FT_UINT16, BASE_DEC_HEX,
5548 NULL, 0x0, NULL, HFILL }
5550 { &hf_ieee_802_1_port_proto_vlan_id,
5551 { "Port and Protocol VLAN Identifier", "lldp.ieee.802_1.port_proto_vlan.id", FT_UINT16, BASE_DEC_HEX,
5552 NULL, 0x0, NULL, HFILL }
5554 { &hf_ieee_802_1_vlan_id,
5555 { "VLAN Identifier", "lldp.ieee.802_1.vlan.id", FT_UINT16, BASE_DEC_HEX,
5556 NULL, 0x0, NULL, HFILL }
5558 { &hf_ieee_802_1_vlan_name_length,
5559 { "VLAN Name Length", "lldp.ieee.802_1.vlan.name_len", FT_UINT8, BASE_DEC,
5560 NULL, 0x0, NULL, HFILL }
5562 { &hf_ieee_802_1_vlan_name,
5563 { "VLAN Name", "lldp.ieee.802_1.vlan.name", FT_STRINGZ, BASE_NONE,
5564 NULL, 0x0, NULL, HFILL }
5566 { &hf_ieee_802_1_proto_id_length,
5567 { "Protocol Identity Length", "lldp.ieee.802_1.proto.id_length", FT_UINT8, BASE_DEC,
5568 NULL, 0x0, NULL, HFILL }
5570 { &hf_ieee_802_1_proto_id,
5571 { "Protocol Identity", "lldp.ieee.802_1.proto.id", FT_BYTES, BASE_NONE,
5572 NULL, 0x0, NULL, HFILL }
5574 { &hf_ieee_802_1_aggregation_status,
5575 { "Aggregation Status", "lldp.ieee.802_1.aggregation_status", FT_UINT8, BASE_HEX,
5576 NULL, 0x0, NULL, HFILL }
5578 { &hf_ieee_802_1_aggregation_status_cap,
5579 { "Aggregation Capability", "lldp.ieee.802_1.aggregation_status.cap", FT_BOOLEAN, 8,
5580 TFS(&tfs_yes_no), 0x01, NULL, HFILL }
5582 { &hf_ieee_802_1_aggregation_status_enabled,
5583 { "Aggregation Status", "lldp.ieee.802_1.aggregation_status.enabled", FT_BOOLEAN, 8,
5584 TFS(&tfs_enabled_disabled), 0x02, NULL, HFILL }
5586 { &hf_ieee_802_1_aggregation_status_porttype,
5587 { "Aggregation Status", "lldp.ieee.802_1.aggregation_status.porttype", FT_UINT8, BASE_DEC,
5588 VALS(porttype_values), 0x0c, NULL, HFILL }
5590 { &hf_ieee_802_1_aggregated_port_id,
5591 { "Aggregated Port Id", "lldp.ieee.802_1.aggregated_port_id", FT_UINT32, BASE_DEC,
5592 NULL, 0, NULL, HFILL }
5594 { &hf_ieee_8021qau_cnpv_prio0,
5595 { "Priority 0 CNPV Capability", "lldp.ieee.802_1qau.cnpv.prio0", FT_BOOLEAN, 8,
5596 TFS(&tfs_enabled_disabled), 0x01, NULL, HFILL }
5598 { &hf_ieee_8021qau_cnpv_prio1,
5599 { "Priority 1 CNPV Capability", "lldp.ieee.802_1qau.cnpv.prio1", FT_BOOLEAN, 8,
5600 TFS(&tfs_enabled_disabled), 0x02, NULL, HFILL }
5602 { &hf_ieee_8021qau_cnpv_prio2,
5603 { "Priority 2 CNPV Capability", "lldp.ieee.802_1qau.cnpv.prio2", FT_BOOLEAN, 8,
5604 TFS(&tfs_enabled_disabled), 0x04, NULL, HFILL }
5606 { &hf_ieee_8021qau_cnpv_prio3,
5607 { "Priority 3 CNPV Capability", "lldp.ieee.802_1qau.cnpv.prio3", FT_BOOLEAN, 8,
5608 TFS(&tfs_enabled_disabled), 0x08, NULL, HFILL }
5610 { &hf_ieee_8021qau_cnpv_prio4,
5611 { "Priority 4 CNPV Capability", "lldp.ieee.802_1qau.cnpv.prio4", FT_BOOLEAN, 8,
5612 TFS(&tfs_enabled_disabled), 0x10, NULL, HFILL }
5614 { &hf_ieee_8021qau_cnpv_prio5,
5615 { "Priority 5 CNPV Capability", "lldp.ieee.802_1qau.cnpv.prio5", FT_BOOLEAN, 8,
5616 TFS(&tfs_enabled_disabled), 0x20, NULL, HFILL }
5618 { &hf_ieee_8021qau_cnpv_prio6,
5619 { "Priority 6 CNPV Capability", "lldp.ieee.802_1qau.cnpv.prio6", FT_BOOLEAN, 8,
5620 TFS(&tfs_enabled_disabled), 0x40, NULL, HFILL }
5622 { &hf_ieee_8021qau_cnpv_prio7,
5623 { "Priority 7 CNPV Capability", "lldp.ieee.802_1qau.cnpv.prio7", FT_BOOLEAN, 8,
5624 TFS(&tfs_enabled_disabled), 0x80, NULL, HFILL }
5626 { &hf_ieee_8021qau_ready_prio0,
5627 { "Priority 0 Ready Indicator", "lldp.ieee.802_1qau.ready.prio0", FT_BOOLEAN, 8,
5628 TFS(&tfs_set_notset), 0x01, NULL, HFILL }
5630 { &hf_ieee_8021qau_ready_prio1,
5631 { "Priority 1 Ready Indicator", "lldp.ieee.802_1qau.ready.prio1", FT_BOOLEAN, 8,
5632 TFS(&tfs_set_notset), 0x02, NULL, HFILL }
5634 { &hf_ieee_8021qau_ready_prio2,
5635 { "Priority 2 Ready Indicator", "lldp.ieee.802_1qau.ready.prio2", FT_BOOLEAN, 8,
5636 TFS(&tfs_set_notset), 0x04, NULL, HFILL }
5638 { &hf_ieee_8021qau_ready_prio3,
5639 { "Priority 3 Ready Indicator", "lldp.ieee.802_1qau.ready.prio3", FT_BOOLEAN, 8,
5640 TFS(&tfs_set_notset), 0x08, NULL, HFILL }
5642 { &hf_ieee_8021qau_ready_prio4,
5643 { "Priority 4 Ready Indicator", "lldp.ieee.802_1qau.ready.prio4", FT_BOOLEAN, 8,
5644 TFS(&tfs_set_notset), 0x10, NULL, HFILL }
5646 { &hf_ieee_8021qau_ready_prio5,
5647 { "Priority 5 Ready Indicator", "lldp.ieee.802_1qau.ready.prio5", FT_BOOLEAN, 8,
5648 TFS(&tfs_set_notset), 0x20, NULL, HFILL }
5650 { &hf_ieee_8021qau_ready_prio6,
5651 { "Priority 6 Ready Indicator", "lldp.ieee.802_1qau.ready.prio6", FT_BOOLEAN, 8,
5652 TFS(&tfs_set_notset), 0x40, NULL, HFILL }
5654 { &hf_ieee_8021qau_ready_prio7,
5655 { "Priority 7 Ready Indicator", "lldp.ieee.802_1qau.ready.prio7", FT_BOOLEAN, 8,
5656 TFS(&tfs_set_notset), 0x80, NULL, HFILL }
5658 { &hf_ieee_8021az_feature_flag_willing,
5659 { "Willing", "lldp.dcbx.ieee.willing", FT_BOOLEAN , 8,
5660 TFS(&tfs_yes_no), 0x80, NULL, HFILL }
5662 { &hf_ieee_8021az_feature_flag_cbs,
5663 { "Credit-Based Shaper", "lldp.dcbx.ieee.ets.cbs", FT_BOOLEAN, 8,
5664 TFS(&tfs_supported_not_supported), 0x40, NULL, HFILL }
5666 { &hf_ieee_8021az_maxtcs,
5667 { "Maximum Number of Traffic Classes", "lldp.dcbx.ieee.ets.maxtcs", FT_UINT8, BASE_DEC,
5668 NULL, 0x7, NULL, HFILL }
5670 { &hf_ieee_8021az_tsa_class0,
5671 { "TSA for Traffic Class 0", "lldp.dcbx.ieee.ets.tsa0", FT_UINT8, BASE_DEC,
5672 VALS(dcbx_ieee_8021az_tsa), 0, "Reserved", HFILL }
5674 { &hf_ieee_8021az_tsa_class1,
5675 { "TSA for Traffic Class 1", "lldp.dcbx.ieee.ets.tsa1", FT_UINT8, BASE_DEC,
5676 VALS(dcbx_ieee_8021az_tsa), 0, "Reserved", HFILL }
5678 { &hf_ieee_8021az_tsa_class2,
5679 { "TSA for Traffic Class 2", "lldp.dcbx.ieee.ets.tsa2", FT_UINT8, BASE_DEC,
5680 VALS(dcbx_ieee_8021az_tsa), 0, "Reserved", HFILL }
5682 { &hf_ieee_8021az_tsa_class3,
5683 { "TSA for Traffic Class 3", "lldp.dcbx.ieee.ets.tsa3", FT_UINT8, BASE_DEC,
5684 VALS(dcbx_ieee_8021az_tsa), 0, "Reserved", HFILL }
5686 { &hf_ieee_8021az_tsa_class4,
5687 { "TSA for Traffic Class 4", "lldp.dcbx.ieee.ets.tsa4", FT_UINT8, BASE_DEC,
5688 VALS(dcbx_ieee_8021az_tsa), 0, "Reserved", HFILL }
5690 { &hf_ieee_8021az_tsa_class5,
5691 { "TSA for Traffic Class 5", "lldp.dcbx.ieee.ets.tsa5", FT_UINT8, BASE_DEC,
5692 VALS(dcbx_ieee_8021az_tsa), 0, "Reserved", HFILL }
5694 { &hf_ieee_8021az_tsa_class6,
5695 { "TSA for Traffic Class 6", "lldp.dcbx.ieee.ets.tsa6", FT_UINT8, BASE_DEC,
5696 VALS(dcbx_ieee_8021az_tsa), 0, "Reserved", HFILL }
5698 { &hf_ieee_8021az_tsa_class7,
5699 { "TSA for Traffic Class 7", "lldp.dcbx.ieee.ets.tsa7", FT_UINT8, BASE_DEC,
5700 VALS(dcbx_ieee_8021az_tsa), 0, "Reserved", HFILL }
5702 { &hf_ieee_8021az_feature_flag_mbc,
5703 { "MACsec Bypass Capability", "lldp.dcbx.ieee.pfc.mbc", FT_BOOLEAN, 8,
5704 TFS(&tfs_capable_not_capable), 0x40, NULL, HFILL }
5706 { &hf_ieee_8021az_pfc_numtcs,
5707 { "Max PFC Enabled Traffic Classes", "lldp.dcbx.ieee.pfc.numtcs", FT_UINT8, BASE_DEC,
5708 NULL, 0xF, NULL, HFILL }
5710 { &hf_ieee_8021az_app_reserved,
5711 { "Reserved", "lldp.dcbx.ieee.app.reserved", FT_UINT8, BASE_HEX,
5712 NULL, 0x0, NULL, HFILL }
5714 { &hf_ieee_8021az_app_prio,
5715 { "Application Priority", "lldp.dcbx.ieee.app.prio", FT_UINT8, BASE_DEC,
5716 NULL, 0xE0, NULL, HFILL }
5718 { &hf_ieee_8021az_app_selector,
5719 { "Application Selector", "lldp.dcbx.iee.app.sf", FT_UINT8, BASE_DEC,
5720 VALS(dcbx_ieee_8021az_sf), 0x7, NULL, HFILL }
5722 { &hf_ieee_802_3_subtype,
5723 { "IEEE 802.3 Subtype", "lldp.ieee.802_3.subtype", FT_UINT8, BASE_HEX,
5724 VALS(ieee_802_3_subtypes), 0x0, NULL, HFILL }
5726 { &hf_ieee_802_3_mac_phy_auto_neg_status,
5727 { "Auto-Negotiation Support/Status", "lldp.ieee.802_3.mac_phy_auto_neg_status", FT_UINT8, BASE_HEX,
5728 NULL, 0x0, NULL, HFILL }
5730 { &hf_ieee_802_3_mac_phy_auto_neg_status_supported,
5731 { "Auto-Negotiation", "lldp.ieee.802_3.mac_phy_auto_neg_status.supported", FT_BOOLEAN, 8,
5732 TFS(&tfs_supported_not_supported), 0x01, NULL, HFILL }
5734 { &hf_ieee_802_3_mac_phy_auto_neg_status_enabled,
5735 { "Auto-Negotiation", "lldp.ieee.802_3.mac_phy_auto_neg_status.enabled", FT_BOOLEAN, 8,
5736 TFS(&tfs_enabled_disabled), 0x02, NULL, HFILL }
5738 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps,
5739 { "PMD Auto-Negotiation Advertised Capability", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps", FT_UINT16, BASE_HEX,
5740 NULL, 0x0, NULL, HFILL }
5742 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_1000base_tfd,
5743 { "1000BASE-T (full duplex mode)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps.1000base_tfd", FT_BOOLEAN, 16,
5744 TFS(&tfs_capable_not_capable), AUTONEG_1000BASE_TFD, NULL, HFILL }
5746 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_1000base_t,
5747 { "1000BASE-T (half duplex mode)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps.1000base_t", FT_BOOLEAN, 16,
5748 TFS(&tfs_capable_not_capable), AUTONEG_1000BASE_T, NULL, HFILL }
5750 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_1000base_xfd,
5751 { "1000BASE-X (-LX, -SX, -CX full duplex mode)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps.1000base_xfd", FT_BOOLEAN, 16,
5752 TFS(&tfs_capable_not_capable), AUTONEG_1000BASE_XFD, NULL, HFILL }
5754 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_1000base_x,
5755 { "1000BASE-X (-LX, -SX, -CX half duplex mode)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps.1000base_x", FT_BOOLEAN, 16,
5756 TFS(&tfs_capable_not_capable), AUTONEG_1000BASE_X, NULL, HFILL }
5758 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_fdx_bpause,
5759 { "Asymmetric and Symmetric PAUSE (for full-duplex links)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps.fdx_bpause", FT_BOOLEAN, 16,
5760 TFS(&tfs_capable_not_capable), AUTONEG_FDX_BPAUSE, NULL, HFILL }
5762 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_fdx_spause,
5763 { "Symmetric PAUSE (for full-duplex links)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps.fdx_spause", FT_BOOLEAN, 16,
5764 TFS(&tfs_capable_not_capable), AUTONEG_FDX_SPAUSE, NULL, HFILL }
5766 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_fdx_apause,
5767 { "Asymmetric PAUSE (for full-duplex links)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps.fdx_apause", FT_BOOLEAN, 16,
5768 TFS(&tfs_capable_not_capable), AUTONEG_FDX_APAUSE, NULL, HFILL }
5770 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_fdx_pause,
5771 { "PAUSE (for full-duplex links)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps.fdx_pause", FT_BOOLEAN, 16,
5772 TFS(&tfs_capable_not_capable), AUTONEG_FDX_PAUSE, NULL, HFILL }
5774 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_100base_t2fd,
5775 { "100BASE-T2 (full duplex mode)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps.100base_t2fd", FT_BOOLEAN, 16,
5776 TFS(&tfs_capable_not_capable), AUTONEG_100BASE_T2FD, NULL, HFILL }
5778 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_100base_t2,
5779 { "100BASE-T2 (half duplex mode)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps.100base_t2", FT_BOOLEAN, 16,
5780 TFS(&tfs_capable_not_capable), AUTONEG_100BASE_T2, NULL, HFILL }
5782 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_100base_txfd,
5783 { "100BASE-TX (full duplex mode)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps.100base_txfd", FT_BOOLEAN, 16,
5784 TFS(&tfs_capable_not_capable), AUTONEG_100BASE_TXFD, NULL, HFILL }
5786 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_100base_tx,
5787 { "100BASE-TX (half duplex mode)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps.100base_tx", FT_BOOLEAN, 16,
5788 TFS(&tfs_capable_not_capable), AUTONEG_100BASE_TX, NULL, HFILL }
5790 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_100base_t4,
5791 { "100BASE-T4", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps.100base_t4", FT_BOOLEAN, 16,
5792 TFS(&tfs_capable_not_capable), AUTONEG_100BASE_T4, NULL, HFILL }
5794 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_10base_tfd,
5795 { "10BASE-T (full duplex mode)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps.10base_tfd", FT_BOOLEAN, 16,
5796 TFS(&tfs_capable_not_capable), AUTONEG_10BASET_FD, NULL, HFILL }
5798 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_10base_t,
5799 { "10BASE-T (half duplex mode)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps.10base_t", FT_BOOLEAN, 16,
5800 TFS(&tfs_capable_not_capable), AUTONEG_10BASE_T, NULL, HFILL }
5802 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_other,
5803 { "Other or unknown", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps.other", FT_BOOLEAN, 16,
5804 TFS(&tfs_capable_not_capable), AUTONEG_OTHER, NULL, HFILL }
5806 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_1000base_tfd,
5807 { "1000BASE-T (full duplex mode)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps_inv.1000base_tfd", FT_BOOLEAN, 16,
5808 TFS(&tfs_capable_not_capable), INV_AUTONEG_1000BASE_TFD, NULL, HFILL }
5810 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_1000base_t,
5811 { "1000BASE-T (half duplex mode)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps_inv.1000base_t", FT_BOOLEAN, 16,
5812 TFS(&tfs_capable_not_capable), INV_AUTONEG_1000BASE_T, NULL, HFILL }
5814 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_1000base_xfd,
5815 { "1000BASE-X (-LX, -SX, -CX full duplex mode)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps_inv.1000base_xfd", FT_BOOLEAN, 16,
5816 TFS(&tfs_capable_not_capable), INV_AUTONEG_1000BASE_XFD, NULL, HFILL }
5818 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_1000base_x,
5819 { "1000BASE-X (-LX, -SX, -CX half duplex mode)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps_inv.1000base_x", FT_BOOLEAN, 16,
5820 TFS(&tfs_capable_not_capable), INV_AUTONEG_1000BASE_X, NULL, HFILL }
5822 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_fdx_bpause,
5823 { "Asymmetric and Symmetric PAUSE (for full-duplex links)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps_inv.fdx_bpause", FT_BOOLEAN, 16,
5824 TFS(&tfs_capable_not_capable), INV_AUTONEG_FDX_BPAUSE, NULL, HFILL }
5826 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_fdx_spause,
5827 { "Symmetric PAUSE (for full-duplex links)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps_inv.fdx_spause", FT_BOOLEAN, 16,
5828 TFS(&tfs_capable_not_capable), INV_AUTONEG_FDX_SPAUSE, NULL, HFILL }
5830 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_fdx_apause,
5831 { "Asymmetric PAUSE (for full-duplex links)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps_inv.fdx_apause", FT_BOOLEAN, 16,
5832 TFS(&tfs_capable_not_capable), INV_AUTONEG_FDX_APAUSE, NULL, HFILL }
5834 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_fdx_pause,
5835 { "PAUSE (for full-duplex links)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps_inv.fdx_pause", FT_BOOLEAN, 16,
5836 TFS(&tfs_capable_not_capable), INV_AUTONEG_FDX_PAUSE, NULL, HFILL }
5838 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_100base_t2fd,
5839 { "100BASE-T2 (full duplex mode)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps_inv.100base_t2fd", FT_BOOLEAN, 16,
5840 TFS(&tfs_capable_not_capable), INV_AUTONEG_100BASE_T2FD, NULL, HFILL }
5842 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_100base_t2,
5843 { "100BASE-T2 (half duplex mode)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps_inv.100base_t2", FT_BOOLEAN, 16,
5844 TFS(&tfs_capable_not_capable), INV_AUTONEG_100BASE_T2, NULL, HFILL }
5846 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_100base_txfd,
5847 { "100BASE-TX (full duplex mode)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps_inv.100base_txfd", FT_BOOLEAN, 16,
5848 TFS(&tfs_capable_not_capable), INV_AUTONEG_100BASE_TXFD, NULL, HFILL }
5850 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_100base_tx,
5851 { "100BASE-TX (half duplex mode)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps_inv.100base_tx", FT_BOOLEAN, 16,
5852 TFS(&tfs_capable_not_capable), INV_AUTONEG_100BASE_TX, NULL, HFILL }
5854 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_100base_t4,
5855 { "100BASE-T4", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps_inv.100base_t4", FT_BOOLEAN, 16,
5856 TFS(&tfs_capable_not_capable), INV_AUTONEG_100BASE_T4, NULL, HFILL }
5858 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_10base_tfd,
5859 { "10BASE-T (full duplex mode)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps_inv.10base_tfd", FT_BOOLEAN, 16,
5860 TFS(&tfs_capable_not_capable), INV_AUTONEG_10BASET_FD, NULL, HFILL }
5862 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_10base_t,
5863 { "10BASE-T (half duplex mode)", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps_inv.10base_t", FT_BOOLEAN, 16,
5864 TFS(&tfs_capable_not_capable), INV_AUTONEG_10BASE_T, NULL, HFILL }
5866 { &hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_other,
5867 { "Other or unknown", "lldp.ieee.802_3.pmd_auto_neg_advertised_caps_inv.other", FT_BOOLEAN, 16,
5868 TFS(&tfs_capable_not_capable), INV_AUTONEG_OTHER, NULL, HFILL }
5870 { &hf_ieee_802_3_pmd_mau_type,
5871 { "Operational MAU Type", "lldp.ieee.802_3.pmd_mau_type", FT_UINT16, BASE_HEX,
5872 VALS(operational_mau_type_values), 0x0, "Unknown", HFILL }
5874 { &hf_ieee_802_3_mdi_power_support,
5875 { "MDI Power Support", "lldp.ieee.802_3.mdi_power_support", FT_UINT8, BASE_HEX,
5876 NULL, 0x0, NULL, HFILL }
5878 { &hf_ieee_802_3_mdi_power_support_port_class,
5879 { "Port Class", "lldp.ieee.802_3.mdi_power_support.port_class", FT_BOOLEAN, 8,
5880 TFS(&tfs_ieee_802_3_pse_pd), 0x01, NULL, HFILL }
5882 { &hf_ieee_802_3_mdi_power_support_pse_power_support,
5883 { "PSE MDI Power", "lldp.ieee.802_3.mdi_power_support.supported", FT_BOOLEAN, 8,
5884 TFS(&tfs_supported_not_supported), 0x02, NULL, HFILL }
5886 { &hf_ieee_802_3_mdi_power_support_pse_power_enabled,
5887 { "PSE MDI Power", "lldp.ieee.802_3.mdi_power_support.enabled", FT_BOOLEAN, 8,
5888 TFS(&tfs_enabled_disabled), 0x04, NULL, HFILL }
5890 { &hf_ieee_802_3_mdi_power_support_pse_pairs,
5891 { "PSE Pairs Control Ability", "lldp.ieee.802_3.mdi_power_support.pse_pairs", FT_BOOLEAN, 8,
5892 TFS(&tfs_yes_no), 0x08, NULL, HFILL }
5894 { &hf_ieee_802_3_mdi_power_pse_pair,
5895 { "PSE Power Pair", "lldp.ieee.802_3.mdi_pse_pair", FT_UINT8, BASE_DEC,
5896 VALS(power_pair_802_3), 0x0, NULL, HFILL }
5898 { &hf_ieee_802_3_mdi_power_class,
5899 { "Power Class", "lldp.ieee.802_3.mdi_power_class", FT_UINT8, BASE_DEC,
5900 VALS(power_class_802_3), 0x0, NULL, HFILL }
5902 { &hf_ieee_802_3_mdi_power_type,
5903 { "Power Type", "lldp.ieee.802_3.mdi_power_type", FT_UINT8, BASE_DEC,
5904 VALS(power_type_802_3), 0xC0, "Unknown", HFILL }
5906 { &hf_ieee_802_3_mdi_power_source,
5907 { "Power Source", "lldp.ieee.802_3.mdi_power_source", FT_UINT8, BASE_DEC,
5908 NULL, 0x30, NULL, HFILL }
5910 { &hf_ieee_802_3_mdi_power_priority,
5911 { "Power Priority", "lldp.ieee.802_3.mdi_power_priority", FT_UINT8, BASE_DEC,
5912 VALS(media_power_priority), 0x03, NULL, HFILL }
5914 { &hf_ieee_802_3_mdi_power_pd4pid,
5915 { "PD 4PID", "lldp.ieee.802_3.mdi_power_pd4pid", FT_BOOLEAN, 8,
5916 TFS(&tfs_supported_not_supported), 0x4, NULL, HFILL }
5918 { &hf_ieee_802_3_mdi_requested_power,
5919 { "PD Requested Power Value", "lldp.ieee.802_3.mdi_pde_requested", FT_UINT16, BASE_CUSTOM,
5920 CF_FUNC(mdi_power_base), 0, NULL, HFILL }
5922 { &hf_ieee_802_3_mdi_allocated_power,
5923 { "PSE Allocated Power Value", "lldp.ieee.802_3.mdi_pse_allocated", FT_UINT16, BASE_CUSTOM,
5924 CF_FUNC(mdi_power_base), 0, NULL, HFILL }
5926 { &hf_ieee_802_3_bt_ds_pd_requested_power_value_mode_a,
5927 { "DS PD Requested Power Value Mode A", "lldp.ieee.802_3.bt_ds_pd_requested_power_value_mode_a", FT_UINT16, BASE_CUSTOM,
5928 CF_FUNC(mdi_power_base), 0, NULL, HFILL }
5930 { &hf_ieee_802_3_bt_ds_pd_requested_power_value_mode_b,
5931 { "DS PD Requested Power Value Mode B", "lldp.ieee.802_3.bt_ds_pd_requested_power_value_mode_b", FT_UINT16, BASE_CUSTOM,
5932 CF_FUNC(mdi_power_base), 0, NULL, HFILL }
5934 { &hf_ieee_802_3_bt_ds_pse_allocated_power_value_alt_a,
5935 { "DS PSE Allocated Power Value Alt A", "lldp.ieee.802_3.bt_ds_pse_allocated_power_value_alt_a", FT_UINT16, BASE_CUSTOM,
5936 CF_FUNC(mdi_power_base), 0, NULL, HFILL }
5938 { &hf_ieee_802_3_bt_ds_pse_allocated_power_value_alt_b,
5939 { "DS PSE Allocated Power Value Alt B", "lldp.ieee.802_3.bt_ds_pse_allocated_power_value_alt_b", FT_UINT16, BASE_CUSTOM,
5940 CF_FUNC(mdi_power_base), 0, NULL, HFILL }
5942 { &hf_ieee_802_3_bt_power_status,
5943 { "Power Status", "lldp.ieee.802_3.bt_power_status", FT_UINT16, BASE_HEX,
5944 NULL, 0, NULL, HFILL }
5946 { &hf_ieee_802_3_bt_pse_powering_status,
5947 { "PSE Powering Status", "lldp.ieee.802_3.bt_pse_powering_status", FT_UINT16, BASE_DEC,
5948 VALS(pse_powering_status_802_3_bt), 0xC000, NULL, HFILL }
5950 { &hf_ieee_802_3_bt_pd_powered_status,
5951 { "PD Powered Status", "lldp.ieee.802_3.bt_pd_powered_status", FT_UINT16, BASE_DEC,
5952 VALS(pd_powered_status_802_3_bt), 0x3000, NULL, HFILL }
5954 { &hf_ieee_802_3_bt_pse_power_pairs_ext,
5955 { "PSE Power Pairs ext", "lldp.ieee.802_3.bt_pse_power_pairs_ext", FT_UINT16, BASE_DEC,
5956 VALS(power_pairs_ext_802_3_bt), 0x0C00, NULL, HFILL }
5958 { &hf_ieee_802_3_bt_ds_pwr_class_ext_a,
5959 { "DS Pwr Class Ext A", "lldp.ieee.802_3.bt_ds_pwr_class_ext_a", FT_UINT16, BASE_DEC,
5960 VALS(power_type_ext_mode_ab_802_3_bt), 0x0380, NULL, HFILL }
5962 { &hf_ieee_802_3_bt_ds_pwr_class_ext_b,
5963 { "DS Pwr Class Ext B", "lldp.ieee.802_3.bt_ds_pwr_class_ext_b", FT_UINT16, BASE_DEC,
5964 VALS(power_type_ext_mode_ab_802_3_bt), 0x0070, NULL, HFILL }
5966 { &hf_ieee_802_3_bt_pwr_class_ext,
5967 { "Pwr Class Ext", "lldp.ieee.802_3.bt_pwr_class_ext_", FT_UINT16, BASE_DEC,
5968 VALS(power_class_ext_802_3_bt), 0x000F, NULL, HFILL }
5970 { &hf_ieee_802_3_bt_system_setup,
5971 { "System Setup", "lldp.ieee.802_3.bt_system_setup", FT_UINT8, BASE_HEX,
5972 NULL, 0, NULL, HFILL }
5974 { &hf_ieee_802_3_bt_power_type_ext,
5975 { "Power Type Ext", "lldp.ieee.802_3.bt_power_type_ext", FT_UINT8, BASE_DEC,
5976 VALS(power_type_ext_802_3_bt), 0x0E, NULL, HFILL }
5978 { &hf_ieee_802_3_bt_power_pd_load,
5979 { "PD Load", "lldp.ieee.802_3.bt_power.pd_load", FT_BOOLEAN, 8,
5980 TFS(&tfs_ieee_802_3_pd_load), 0x1, NULL, HFILL }
5982 { &hf_ieee_802_3_bt_pse_maximum_available_power_value,
5983 { "PSE Maximum Available Power Value", "lldp.ieee.802_3.bt_pse_maximum_available_power_value", FT_UINT16, BASE_CUSTOM,
5984 CF_FUNC(mdi_power_base), 0, NULL, HFILL }
5986 { &hf_ieee_802_3_bt_autoclass,
5987 { "Autoclass", "lldp.ieee.802_3.bt_autoclass", FT_UINT8, BASE_HEX,
5988 NULL, 0, NULL, HFILL }
5990 { &hf_ieee_802_3_bt_pse_autoclass_support,
5991 { "PSE Autoclass support", "lldp.ieee.802_3.bt_pse_autoclass_support", FT_UINT8, BASE_DEC,
5992 NULL, 0x04, NULL, HFILL }
5994 { &hf_ieee_802_3_bt_autoclass_completed,
5995 { "Autoclass Completed", "lldp.ieee.802_3.bt_autoclass_completed", FT_UINT8, BASE_DEC,
5996 NULL, 0x02, NULL, HFILL }
5998 { &hf_ieee_802_3_bt_autoclass_request,
5999 { "Autoclass Request", "lldp.ieee.802_3.bt_autoclass_request", FT_UINT8, BASE_DEC,
6000 NULL, 0x01, NULL, HFILL }
6002 { &hf_ieee_802_3_bt_autoclass_reserved,
6003 { "Autoclass Reserved", "lldp.ieee.802_3.bt_autoclass_reserved", FT_UINT8, BASE_HEX,
6004 NULL, 0xF8, NULL, HFILL }
6006 { &hf_ieee_802_3_bt_power_down,
6007 { "Power down", "lldp.ieee.802_3.bt_power_down", FT_UINT24, BASE_HEX,
6008 NULL, 0, NULL, HFILL }
6010 { &hf_ieee_802_3_bt_power_down_request,
6011 { "Power down request", "lldp.ieee.802_3.bt_power_down_request", FT_UINT24, BASE_DEC,
6012 NULL, 0xFC0000, NULL, HFILL }
6014 { &hf_ieee_802_3_bt_power_down_time,
6015 { "Power down time", "lldp.ieee.802_3.bt_power_down_time", FT_UINT24, BASE_DEC,
6016 NULL, 0x03FFFF, NULL, HFILL }
6018 { &hf_ieee_802_3_aggregation_status,
6019 { "Aggregation Status", "lldp.ieee.802_3.aggregation_status", FT_UINT8, BASE_HEX,
6020 NULL, 0x0, NULL, HFILL }
6022 { &hf_ieee_802_3_aggregation_status_cap,
6023 { "Aggregation Capability", "lldp.ieee.802_3.aggregation_status.cap", FT_BOOLEAN, 8,
6024 TFS(&tfs_yes_no), 0x01, NULL, HFILL }
6026 { &hf_ieee_802_3_aggregation_status_enabled,
6027 { "Aggregation Status", "lldp.ieee.802_3.aggregation_status.enabled", FT_BOOLEAN, 8,
6028 TFS(&tfs_enabled_disabled), 0x02, NULL, HFILL }
6030 { &hf_ieee_802_3_aggregated_port_id,
6031 { "Aggregated Port Id", "lldp.ieee.802_3.aggregated_port_id", FT_UINT32, BASE_DEC,
6032 NULL, 0, NULL, HFILL }
6034 { &hf_ieee_802_3_max_frame_size,
6035 { "Maximum Frame Size", "lldp.ieee.802_3.max_frame_size", FT_UINT16, BASE_DEC,
6036 NULL, 0, NULL, HFILL }
6038 { &hf_ieee_802_3_eee_transmit,
6039 { "Transmit", "lldp.ieee.802_3.eee.transmit", FT_UINT16, BASE_DEC,
6040 NULL, 0, NULL, HFILL }
6042 { &hf_ieee_802_3_eee_receive,
6043 { "Receive", "lldp.ieee.802_3.eee.receive", FT_UINT16, BASE_DEC,
6044 NULL, 0, NULL, HFILL }
6046 { &hf_ieee_802_3_eee_fallback_receive,
6047 { "Fallback Receive", "lldp.ieee.802_3.eee.fallback_receive", FT_UINT16, BASE_DEC,
6048 NULL, 0, NULL, HFILL }
6050 { &hf_ieee_802_3_eee_echo_transmit,
6051 { "Echo Transmit", "lldp.ieee.802_3.eee.echo_transmit", FT_UINT16, BASE_DEC,
6052 NULL, 0, NULL, HFILL }
6054 { &hf_ieee_802_3_eee_echo_receive,
6055 { "Echo Receive", "lldp.ieee.802_3.eee.echo_receive", FT_UINT16, BASE_DEC,
6056 NULL, 0, NULL, HFILL }
6058 { &hf_ieee_802_1qbg_subtype,
6059 { "IEEE 802.1Qbg Subtype", "lldp.ieee.802_1qbg.subtype", FT_UINT8, BASE_HEX,
6060 VALS(ieee_802_1qbg_subtypes), 0x0, NULL, HFILL }
6062 { &hf_ieee_802_1qbg_evb_support_caps,
6063 { "Supported capabilities", "lldp.ieee.802_1qbg.evb_support_caps", FT_UINT16, BASE_HEX,
6064 NULL, 0x0, NULL, HFILL }
6066 { &hf_ieee_802_1qbg_evb_support_caps_std,
6067 { "Standard bridging (STD)", "lldp.ieee.802_1qbg.evb_support_caps.std", FT_BOOLEAN, 16,
6068 TFS(&tfs_capable_not_capable), EVB_CAPA_STD, NULL, HFILL }
6070 { &hf_ieee_802_1qbg_evb_support_caps_rr,
6071 { "Reflective relay (RR)", "lldp.ieee.802_1qbg.evb_support_caps.rr", FT_BOOLEAN, 16,
6072 TFS(&tfs_capable_not_capable), EVB_CAPA_RR, NULL, HFILL }
6074 { &hf_ieee_802_1qbg_evb_support_caps_rte,
6075 { "Retransmission timer exponent (RTE)", "lldp.ieee.802_1qbg.evb_support_caps.rte", FT_BOOLEAN, 16,
6076 TFS(&tfs_capable_not_capable), EVB_CAPA_RTE, NULL, HFILL }
6078 { &hf_ieee_802_1qbg_evb_support_caps_ecp,
6079 { "Edge control protocol (ECP)", "lldp.ieee.802_1qbg.evb_support_caps.ecp", FT_BOOLEAN, 16,
6080 TFS(&tfs_capable_not_capable), EVB_CAPA_ECP, NULL, HFILL }
6082 { &hf_ieee_802_1qbg_evb_support_caps_vdp,
6083 { "VSI discovery protocol (VDP)", "lldp.ieee.802_1qbg.evb_support_caps.vdp", FT_BOOLEAN, 16,
6084 TFS(&tfs_capable_not_capable), EVB_CAPA_VDP, NULL, HFILL }
6086 { &hf_ieee_802_1qbg_evb_configure_caps,
6087 { "Configured capabilities", "lldp.ieee.802_1qbg.evb_configure_caps", FT_UINT16, BASE_HEX,
6088 NULL, 0x0, NULL, HFILL }
6090 { &hf_ieee_802_1qbg_evb_configure_caps_std,
6091 { "Standard bridging (STD)", "lldp.ieee.802_1qbg.evb_configure_caps.std", FT_BOOLEAN, 16,
6092 TFS(&tfs_capable_not_capable), EVB_CAPA_STD, NULL, HFILL }
6094 { &hf_ieee_802_1qbg_evb_configure_caps_rr,
6095 { "Reflective relay (RR)", "lldp.ieee.802_1qbg.evb_configure_caps.rr", FT_BOOLEAN, 16,
6096 TFS(&tfs_capable_not_capable), EVB_CAPA_RR, NULL, HFILL }
6098 { &hf_ieee_802_1qbg_evb_configure_caps_rte,
6099 { "Retransmission timer exponent (RTE)", "lldp.ieee.802_1qbg.evb_configure_caps.rte", FT_BOOLEAN, 16,
6100 TFS(&tfs_capable_not_capable), EVB_CAPA_RTE, NULL, HFILL }
6102 { &hf_ieee_802_1qbg_evb_configure_caps_ecp,
6103 { "Edge control protocol (ECP)", "lldp.ieee.802_1qbg.evb_configure_caps.ecp", FT_BOOLEAN, 16,
6104 TFS(&tfs_capable_not_capable), EVB_CAPA_ECP, NULL, HFILL }
6106 { &hf_ieee_802_1qbg_evb_configure_caps_vdp,
6107 { "VSI discovery protocol (VDP)", "lldp.ieee.802_1qbg.evb_configure_caps.vdp", FT_BOOLEAN, 16,
6108 TFS(&tfs_capable_not_capable), EVB_CAPA_VDP, NULL, HFILL }
6110 { &hf_ieee_802_1qbg_evb_supported_vsi,
6111 { "Supported No of VSIs", "lldp.ieee.802_1qbg.evb_supported_vsi", FT_UINT16, BASE_DEC,
6112 NULL, 0x0, NULL, HFILL }
6114 { &hf_ieee_802_1qbg_evb_configured_vsi,
6115 { "Configured No of VSIs", "lldp.ieee.802_1qbg.evb_configured_vsi", FT_UINT16, BASE_DEC,
6116 NULL, 0x0, NULL, HFILL }
6118 { &hf_ieee_802_1qbg_evb_retrans_timer,
6119 { "Retransmission timer exponent", "lldp.ieee.802_1qbg.evb_retrans_timer", FT_UINT8, BASE_DEC,
6120 NULL, 0x0, NULL, HFILL }
6122 { &hf_ieee_802_3br_aec,
6123 { "Additional Ethernet Capabilities", "lldp.ieee.802_3br.eac", FT_UINT16, BASE_HEX,
6124 NULL, 0x0, NULL, HFILL }
6126 { &hf_ieee_802_3br_aec_support,
6127 { "Preemption capabilities support", "lldp.ieee.802_3br.aec.support", FT_BOOLEAN, 16,
6128 TFS(&tfs_supported_not_supported), IEEE_802_3BR_AEC_SUPPORT, NULL, HFILL }
6130 { &hf_ieee_802_3br_aec_enable,
6131 { "Preemption capabilities enable", "lldp.ieee.802_3br.aec.enable", FT_BOOLEAN, 16,
6132 TFS(&tfs_enabled_disabled), IEEE_802_3BR_AEC_ENABLE, NULL, HFILL }
6134 { &hf_ieee_802_3br_aec_active,
6135 { "Preemption capabilities active", "lldp.ieee.802_3br.aec.active", FT_BOOLEAN, 16,
6136 TFS(&tfs_active_inactive), IEEE_802_3BR_AEC_ACTIVE, NULL, HFILL }
6138 { &hf_ieee_802_3br_aec_addfragsize,
6139 { "Additional Fragment Size", "lldp.ieee.802_3br.aec.addfragsize", FT_UINT16, BASE_DEC,
6140 NULL, IEEE_802_3BR_AEC_ADDFRAGSIZE, NULL, HFILL }
6142 { &hf_ieee_802_3br_aec_reserved,
6143 { "Reserved", "lldp.ieee.802_3br.aec.reserved", FT_UINT16, BASE_HEX,
6144 NULL, IEEE_802_3BR_AEC_RESERVED, NULL, HFILL }
6146 { &hf_media_tlv_subtype,
6147 { "Media Subtype", "lldp.media.subtype", FT_UINT8, BASE_HEX,
6148 VALS(media_subtypes), 0x0, NULL, HFILL }
6150 { &hf_media_tlv_subtype_caps,
6151 { "Capabilities", "lldp.media.subtype.caps", FT_UINT16, BASE_HEX,
6152 NULL, 0x0, NULL, HFILL }
6154 { &hf_media_tlv_subtype_caps_llpd,
6155 { "LLDP-MED Capabilities", "lldp.media.subtype.caps.llpd", FT_BOOLEAN, 16,
6156 TFS(&tfs_capable_not_capable), MEDIA_CAPABILITY_LLDP, NULL, HFILL }
6158 { &hf_media_tlv_subtype_caps_network_policy,
6159 { "Network Policy", "lldp.media.subtype.caps.network_policy", FT_BOOLEAN, 16,
6160 TFS(&tfs_capable_not_capable), MEDIA_CAPABILITY_NETWORK_POLICY, NULL, HFILL }
6162 { &hf_media_tlv_subtype_caps_location_id,
6163 { "Location Identification", "lldp.media.subtype.caps.location_id", FT_BOOLEAN, 16,
6164 TFS(&tfs_capable_not_capable), MEDIA_CAPABILITY_LOCATION_ID, NULL, HFILL }
6166 { &hf_media_tlv_subtype_caps_mdi_pse,
6167 { "Extended Power via MDI-PSE", "lldp.media.subtype.caps.mdi_pse", FT_BOOLEAN, 16,
6168 TFS(&tfs_capable_not_capable), MEDIA_CAPABILITY_MDI_PSE, NULL, HFILL }
6170 { &hf_media_tlv_subtype_caps_mid_pd,
6171 { "Extended Power via MDI-PD", "lldp.media.subtype.caps.mid_pd", FT_BOOLEAN, 16,
6172 TFS(&tfs_capable_not_capable), MEDIA_CAPABILITY_MDI_PD, NULL, HFILL }
6174 { &hf_media_tlv_subtype_caps_inventory,
6175 { "Inventory", "lldp.media.subtype.caps.inventory", FT_BOOLEAN, 16,
6176 TFS(&tfs_capable_not_capable), MEDIA_CAPABILITY_INVENTORY, NULL, HFILL }
6178 { &hf_media_tlv_subtype_class,
6179 { "Class Type", "lldp.media.subtype.class", FT_UINT8, BASE_DEC,
6180 VALS(media_class_values), 0x0, "Unknown", HFILL }
6182 { &hf_media_application_type,
6183 { "Application Type", "lldp.media.app_type", FT_UINT8, BASE_DEC,
6184 VALS(media_application_type), 0x0, "Unknown", HFILL }
6186 { &hf_media_policy_flag,
6187 { "Policy", "lldp.media.policy_flag", FT_BOOLEAN, 24,
6188 TFS(&tfs_unknown_defined), 0x800000, NULL, HFILL }
6190 { &hf_media_tag_flag,
6191 { "Tagged", "lldp.media.tag_flag", FT_BOOLEAN, 24,
6192 TFS(&tfs_yes_no), 0x400000, NULL, HFILL }
6194 { &hf_media_vlan_id,
6195 { "VLAN Id", "lldp.media.vlan_id", FT_UINT24, BASE_DEC,
6196 NULL, 0x1FFE00, NULL, HFILL }
6198 { &hf_media_l2_prio,
6199 { "L2 Priority", "lldp.media.l2_prio", FT_UINT24, BASE_DEC,
6200 NULL, 0x0001C0, NULL, HFILL }
6202 { &hf_media_dscp,
6203 { "DSCP Priority", "lldp.media.dscp", FT_UINT24, BASE_DEC,
6204 NULL, 0x00003F, NULL, HFILL }
6206 { &hf_media_loc_data_format,
6207 { "Location Data Format", "lldp.media.loc.data_format", FT_UINT8, BASE_DEC,
6208 VALS(location_data_format), 0x0, NULL, HFILL }
6210 { &hf_media_loc_lat_resolution,
6211 { "Latitude Resolution", "lldp.media.loc.lat_resolution", FT_UINT8, BASE_CUSTOM,
6212 CF_FUNC(latitude_or_longitude_resolution), 0xFC, NULL, HFILL }
6214 { &hf_media_loc_lat,
6215 { "Latitude", "lldp.media.loc.latitude", FT_UINT40, BASE_CUSTOM,
6216 CF_FUNC(latitude_base), 0x0, NULL, HFILL }
6218 { &hf_media_loc_long_resolution,
6219 { "Longitude Resolution", "lldp.media.loc.long_resolution", FT_UINT8, BASE_CUSTOM,
6220 CF_FUNC(latitude_or_longitude_resolution), 0xFC, NULL, HFILL }
6222 { &hf_media_loc_long,
6223 { "Longitude", "lldp.media.loc.longitude", FT_UINT40, BASE_CUSTOM,
6224 CF_FUNC(longitude_base), 0x0, NULL, HFILL }
6226 { &hf_media_loc_alt_type,
6227 { "Altitude Type", "lldp.media.loc.alt_type", FT_UINT8, BASE_DEC,
6228 VALS(altitude_type), 0xF0, "Unknown", HFILL }
6230 { &hf_media_loc_alt_resolution,
6231 { "Altitude Resolution", "lldp.media.loc.alt_resolution", FT_UINT16, BASE_CUSTOM,
6232 CF_FUNC(altitude_resolution), 0x0FC0, NULL, HFILL }
6234 { &hf_media_loc_alt,
6235 { "Altitude", "lldp.media.loc.altitude", FT_UINT32, BASE_CUSTOM,
6236 CF_FUNC(altitude_base), 0x0, NULL, HFILL }
6238 { &hf_media_loc_ver,
6239 { "Ver", "lldp.media.loc.ver", FT_UINT8, BASE_DEC,
6240 NULL, 0xC0, NULL, HFILL }
6242 { &hf_media_loc_reserved,
6243 { "Reserved", "lldp.media.loc.reserved", FT_UINT8, BASE_DEC,
6244 NULL, 0x38, NULL, HFILL }
6246 { &hf_media_loc_datum,
6247 { "Datum", "lldp.media.loc.datum", FT_UINT8, BASE_DEC,
6248 VALS(datum_type_values), 0x07, NULL, HFILL }
6250 { &hf_media_civic_lci_length,
6251 { "LCI Length", "lldp.media.civic.length", FT_UINT8, BASE_DEC,
6252 NULL, 0x0, NULL, HFILL }
6254 { &hf_media_civic_what,
6255 { "What", "lldp.media.civic.what", FT_UINT8, BASE_DEC,
6256 VALS(civic_address_what_values), 0x0, "Unknown", HFILL }
6258 { &hf_media_civic_country,
6259 { "Country", "lldp.media.civic.country", FT_STRING, BASE_NONE,
6260 NULL, 0x0, NULL, HFILL }
6262 { &hf_media_civic_addr_type,
6263 { "CA Type", "lldp.media.civic.type", FT_UINT8, BASE_DEC,
6264 VALS(civic_address_type_values), 0x0, "Unknown", HFILL }
6266 { &hf_media_civic_addr_len,
6267 { "CA Length", "lldp.media.civic.addr_length", FT_UINT8, BASE_DEC,
6268 NULL, 0x0, NULL, HFILL }
6270 { &hf_media_civic_addr_value,
6271 { "CA Value", "lldp.media.civic.value", FT_STRINGZ, BASE_NONE,
6272 NULL, 0x0, NULL, HFILL }
6274 { &hf_media_ecs,
6275 { "ELIN", "lldp.media.ecs", FT_STRINGZ, BASE_NONE,
6276 NULL, 0x0, NULL, HFILL }
6278 { &hf_media_power_type,
6279 { "Power Type", "lldp.media.power.type", FT_UINT8, BASE_DEC,
6280 VALS(media_power_type), 0xC0, "Unknown", HFILL }
6282 { &hf_media_power_source,
6283 { "Power Source", "lldp.media.power.source", FT_UINT8, BASE_DEC,
6284 NULL, 0x30, NULL, HFILL }
6286 { &hf_media_power_priority,
6287 { "Power Priority", "lldp.media.power.prio", FT_UINT8, BASE_DEC,
6288 VALS(media_power_priority), 0x0F, "Reserved", HFILL }
6290 { &hf_media_power_value,
6291 { "Power Value", "lldp.media.power.value", FT_UINT16, BASE_CUSTOM,
6292 CF_FUNC(media_power_base), 0x0, NULL, HFILL }
6294 { &hf_media_hardware,
6295 { "Hardware Revision", "lldp.media.hardware", FT_STRINGZPAD, BASE_NONE,
6296 NULL, 0x0, NULL, HFILL }
6298 { &hf_media_firmware,
6299 { "Firmware Revision", "lldp.media.firmware", FT_STRINGZPAD, BASE_NONE,
6300 NULL, 0x0, NULL, HFILL }
6302 { &hf_media_software,
6303 { "Software Revision", "lldp.media.software", FT_STRINGZPAD, BASE_NONE,
6304 NULL, 0x0, NULL, HFILL }
6306 { &hf_media_sn,
6307 { "Serial Number", "lldp.media.sn", FT_STRINGZPAD, BASE_NONE,
6308 NULL, 0x0, NULL, HFILL }
6310 { &hf_media_manufacturer,
6311 { "Manufacturer Name", "lldp.media.manufacturer", FT_STRINGZPAD, BASE_NONE,
6312 NULL, 0x0, NULL, HFILL }
6314 { &hf_media_model,
6315 { "Model Name", "lldp.media.model", FT_STRINGZPAD, BASE_NONE,
6316 NULL, 0x0, NULL, HFILL }
6318 { &hf_media_asset,
6319 { "Asset ID", "lldp.media.asset", FT_STRINGZPAD, BASE_NONE,
6320 NULL, 0x0, NULL, HFILL }
6322 { &hf_profinet_tlv_subtype,
6323 { "Subtype", "lldp.profinet.subtype", FT_UINT8, BASE_HEX,
6324 VALS(profinet_subtypes), 0x0, "PROFINET Subtype", HFILL }
6326 { &hf_profinet_port_rx_delay_local,
6327 { "Port RX Delay Local", "lldp.profinet.port_rx_delay_local", FT_UINT32, BASE_DEC,
6328 NULL, 0x0, NULL, HFILL }
6330 { &hf_profinet_port_rx_delay_remote,
6331 { "Port RX Delay Remote", "lldp.profinet.port_rx_delay_remote", FT_UINT32, BASE_DEC,
6332 NULL, 0x0, NULL, HFILL }
6334 { &hf_profinet_port_tx_delay_local,
6335 { "Port TX Delay Local", "lldp.profinet.port_tx_delay_local", FT_UINT32, BASE_DEC,
6336 NULL, 0x0, NULL, HFILL }
6338 { &hf_profinet_port_tx_delay_remote,
6339 { "Port TX Delay Remote", "lldp.profinet.port_tx_delay_remote", FT_UINT32, BASE_DEC,
6340 NULL, 0x0, NULL, HFILL }
6342 { &hf_profinet_cable_delay_local,
6343 { "Port Cable Delay Local", "lldp.profinet.cable_delay_local", FT_UINT32, BASE_DEC,
6344 NULL, 0x0, NULL, HFILL }
6346 { &hf_profinet_class2_port_status,
6347 { "RTClass2 Port Status", "lldp.profinet.rtc2_port_status", FT_UINT16, BASE_HEX,
6348 VALS(profinet_port2_status_vals), 0x0, NULL, HFILL }
6350 { &hf_profinet_class3_port_status,
6351 { "RTClass3 Port Status", "lldp.profinet.rtc3_port_status", FT_UINT16, BASE_HEX,
6352 VALS(profinet_port3_status_vals), 0x07, NULL, HFILL }
6354 /* class3_port state got some new BITs */
6355 { &hf_profinet_class3_port_status_Fragmentation,
6356 { "RTClass3_PortStatus.Fragmentation", "lldp.profinet.rtc3_port_status.fragmentation", FT_BOOLEAN, 16,
6357 TFS(&tfs_on_off), 0x1000, NULL, HFILL }
6359 { &hf_profinet_class3_port_status_reserved,
6360 { "RTClass3_PortStatus.reserved", "lldp.profinet.rtc3_port_status.reserved", FT_UINT16, BASE_HEX,
6361 NULL, 0x0FF8, "reserved", HFILL }
6363 { &hf_profinet_class3_port_status_PreambleLength,
6364 { "RTClass3_PortStatus.PreambleLength", "lldp.profinet.rtc3_port_status.preambleLength", FT_UINT16, BASE_HEX,
6365 VALS(profinet_port3_status_PreambleLength), 0x2000, NULL, HFILL }
6367 { &hf_profinet_mrp_domain_uuid,
6368 { "MRP DomainUUID", "lldp.profinet.mrp_domain_uuid", FT_GUID, BASE_NONE,
6369 NULL, 0x0, NULL, HFILL }
6371 { &hf_profinet_tsn_domain_uuid,
6372 { "TSN DomainUUID", "lldp.profinet.tsn_domain_uuid", FT_GUID, BASE_NONE,
6373 NULL, 0x0, NULL, HFILL }
6375 { &hf_profinet_tsn_nme_management_addr,
6376 { "TSN NME Management Address", "lldp.profinet.tsn_nme_management_addr", FT_BYTES, BASE_NONE,
6377 NULL, 0x0, NULL, HFILL }
6379 { &hf_profinet_tsn_nme_management_addr_str_length,
6380 { "TSN NME Management Address String Length", "lldp.profinet.tsn_nme_management_addr_str_length", FT_UINT8, BASE_HEX,
6381 NULL, 0x0, NULL, HFILL }
6383 { &hf_profinet_tsn_nme_management_addr_subtype,
6384 { "TSN NME Management Address Subtype", "lldp.profinet.tsn_nme_management_addr_subtype", FT_UINT8, BASE_HEX,
6385 NULL, 0x0, NULL, HFILL }
6387 { &hf_profinet_tsn_nme_name_uuid,
6388 { "TSN NME Name UUID", "lldp.profinet.tsn_nme_name_uuid", FT_GUID, BASE_NONE,
6389 NULL, 0x0, NULL, HFILL }
6391 { &hf_profinet_tsn_nme_parameter_uuid,
6392 { "TSN NME Parameter UUID", "lldp.profinet.tsn_nme_parameter_uuid", FT_GUID, BASE_NONE,
6393 NULL, 0x0, NULL, HFILL }
6395 { &hf_profinet_time_domain_number,
6396 { "Time Domain Number", "lldp.profinet.time_domain_number", FT_UINT16, BASE_HEX,
6397 VALS(profinet_time_domain_number_vals), 0x0, NULL, HFILL }
6399 { &hf_profinet_time_domain_uuid,
6400 { "Time Domain UUID", "lldp.profinet.time_domain_uuid", FT_GUID, BASE_NONE,
6401 NULL, 0x0, NULL, HFILL }
6403 { &hf_profinet_time_domain_master_identity,
6404 { "Time Domain Master Identity", "lldp.profinet.time_domain_master_identity", FT_BYTES, BASE_NONE,
6405 0x0, 0x0, NULL, HFILL }
6407 { &hf_profinet_mrrt_port_status,
6408 { "MRRT PortStatus", "lldp.profinet.mrrt_port_status", FT_UINT16, BASE_HEX,
6409 VALS(profinet_mrrt_port_status_vals), 0x0, NULL, HFILL }
6411 { &hf_profinet_cm_mac,
6412 { "CMMacAdd", "lldp.profinet.cm_mac_add", FT_ETHER, BASE_NONE,
6413 NULL, 0x0, "CMResponderMacAdd or CMInitiatorMacAdd", HFILL }
6415 { &hf_profinet_master_source_address,
6416 { "MasterSourceAddress", "lldp.profinet.master_source_address", FT_ETHER, BASE_NONE,
6417 NULL, 0x0, NULL, HFILL }
6419 { &hf_profinet_subdomain_uuid,
6420 { "SubdomainUUID", "lldp.profinet.subdomain_uuid", FT_GUID, BASE_NONE,
6421 NULL, 0x0, NULL, HFILL }
6423 { &hf_profinet_ir_data_uuid,
6424 { "IRDataUUID", "lldp.profinet.ir_data_uuid", FT_GUID, BASE_NONE,
6425 NULL, 0x0, NULL, HFILL }
6427 { &hf_profinet_length_of_period_valid,
6428 { "LengthOfPeriod.Valid", "lldp.profinet.length_of_period_valid", FT_UINT32, BASE_DEC,
6429 NULL, 0x80000000, "Length field is valid/invalid", HFILL }
6431 { &hf_profinet_length_of_period_length,
6432 { "LengthOfPeriod.Length", "lldp.profinet.length_of_period_length", FT_UINT32, BASE_DEC,
6433 NULL, 0x7FFFFFFF, "Duration of a cycle in nanoseconds", HFILL }
6435 { &hf_profinet_red_period_begin_valid,
6436 { "RedPeriodBegin.Valid", "lldp.profinet.red_period_begin_valid", FT_UINT32, BASE_DEC,
6437 NULL, 0x80000000, "Offset field is valid/invalid", HFILL }
6439 { &hf_profinet_red_period_begin_offset,
6440 { "RedPeriodBegin.Offset", "lldp.profinet.red_period_begin_offset", FT_UINT32, BASE_DEC,
6441 NULL, 0x7FFFFFFF, "RT_CLASS_3 period, offset to cycle begin in nanoseconds", HFILL }
6443 { &hf_profinet_orange_period_begin_valid,
6444 { "OrangePeriodBegin.Valid", "lldp.profinet.orange_period_begin_valid", FT_UINT32, BASE_DEC,
6445 NULL, 0x80000000, "Offset field is valid/invalid", HFILL }
6447 { &hf_profinet_orange_period_begin_offset,
6448 { "OrangePeriodBegin.Offset","lldp.profinet.orange_period_begin_offset", FT_UINT32, BASE_DEC,
6449 NULL, 0x7FFFFFFF, "RT_CLASS_2 period, offset to cycle begin in nanoseconds", HFILL }
6451 { &hf_profinet_green_period_begin_valid,
6452 { "GreenPeriodBegin.Valid", "lldp.profinet.green_period_begin_valid", FT_UINT32, BASE_DEC,
6453 NULL, 0x80000000, "Offset field is valid/invalid", HFILL }
6455 { &hf_profinet_green_period_begin_offset,
6456 { "GreenPeriodBegin.Offset", "lldp.profinet.green_period_begin_offset", FT_UINT32, BASE_DEC,
6457 NULL, 0x7FFFFFFF, "Unrestricted period, offset to cycle begin in nanoseconds", HFILL }
6459 /* Cisco generic */
6460 { &hf_cisco_subtype,
6461 { "Cisco Subtype", "lldp.cisco.subtype", FT_UINT8, BASE_HEX,
6462 VALS(cisco_subtypes), 0x0, NULL, HFILL }
6464 { &hf_cisco_upoe,
6465 { "UPOE Capabilities", "lldp.cisco.upoe", FT_UINT8, BASE_HEX,
6466 NULL, 0x0, "PSE/PD Capabilities", HFILL }
6468 { &hf_cisco_upoe_supported,
6469 { "UPOE Supported", "lldp.cisco.upoe.supported", FT_BOOLEAN, 8,
6470 TFS(&tfs_yes_no), 0x01, "UPOE (4-pair POE) Supported", HFILL }
6472 { &hf_cisco_upoe_altb_detection,
6473 { "ALT-B Detection required", "lldp.cisco.upoe.altb_detection_required", FT_BOOLEAN, 8,
6474 TFS(&tfs_yes_no), 0x02, "ALT-B pair Detection/Classification Required", HFILL }
6476 { &hf_cisco_upoe_req_spare_pair,
6477 { "PD Request Spare Pair PoE", "lldp.cisco.upoe.pd_altb_desired", FT_BOOLEAN, 8,
6478 TFS(&tfs_desired_not_desired), 0x04, "PD ALT-B Pair Desired", HFILL }
6480 { &hf_cisco_upoe_pse_spare_pair_oper,
6481 { "PSE Spare Pair PoE", "lldp.cisco.upoe.pse_altb_oper", FT_BOOLEAN, 8,
6482 TFS(&tfs_enabled_disabled), 0x08, "PSE ALT-B Pair Operational State", HFILL }
6484 /* Cisco ACI */
6485 { &hf_cisco_aci_portstate,
6486 { "Port State", "lldp.cisco.portstate", FT_UINT8, BASE_NONE,
6487 VALS(cisco_portstate_vals), 0x0, NULL, HFILL }
6489 { &hf_cisco_aci_noderole,
6490 { "Node Role", "lldp.cisco.noderole", FT_UINT8, BASE_DEC,
6491 VALS(cisco_noderole_vals), 0x0, NULL, HFILL }
6493 { &hf_cisco_aci_nodeid,
6494 { "Node ID", "lldp.cisco.nodeid", FT_UINT32, BASE_DEC,
6495 NULL, 0x0, NULL, HFILL }
6497 { &hf_cisco_aci_spinelevel,
6498 { "Spine Level", "lldp.cisco.spinelevel", FT_UINT8, BASE_DEC,
6499 NULL, 0x0, NULL, HFILL }
6501 { &hf_cisco_aci_podid,
6502 { "Pod ID", "lldp.cisco.podid", FT_UINT16, BASE_DEC,
6503 NULL, 0x0, NULL, HFILL }
6505 { &hf_cisco_aci_fabricname,
6506 { "Fabric Name", "lldp.cisco.fabricname", FT_STRING, BASE_NONE,
6507 NULL, 0x0, NULL, HFILL }
6509 { &hf_cisco_aci_apiclist,
6510 { "Appliance Vector", "lldp.cisco.apiclist", FT_BYTES, BASE_NONE,
6511 NULL, 0x0, NULL, HFILL }
6513 { &hf_cisco_aci_apicid,
6514 { "APIC ID", "lldp.cisco.apicid", FT_UINT8, BASE_DEC,
6515 NULL, 0x0, NULL, HFILL }
6517 { &hf_cisco_aci_apicipv4,
6518 { "APIC IPv4", "lldp.cisco.apicipv4", FT_IPv4, BASE_NONE,
6519 NULL, 0x0, NULL, HFILL }
6521 { &hf_cisco_aci_apicuuid,
6522 { "APIC UUID", "lldp.cisco.apicuuid", FT_STRING, BASE_NONE,
6523 NULL, 0x0, NULL, HFILL }
6525 { &hf_cisco_aci_nodeip,
6526 { "Node IP", "lldp.cisco.nodeip", FT_IPv4, BASE_NONE,
6527 NULL, 0x0, NULL, HFILL }
6529 { &hf_cisco_aci_portrole,
6530 { "Port Role", "lldp.cisco.portrole", FT_UINT8, BASE_NONE,
6531 VALS(cisco_portrole_vals), 0x0, NULL, HFILL }
6533 { &hf_cisco_aci_version,
6534 { "Version", "lldp.cisco.version", FT_STRING, BASE_NONE,
6535 NULL, 0x0, NULL, HFILL }
6537 { &hf_cisco_aci_fabricvlan,
6538 { "Fabric VLAN", "lldp.cisco.fabricvlan", FT_UINT16, BASE_DEC,
6539 NULL, 0x0, NULL, HFILL }
6541 { &hf_cisco_aci_serialno,
6542 { "Serial No", "lldp.cisco.serialno", FT_STRING, BASE_NONE,
6543 NULL, 0x0, NULL, HFILL }
6545 { &hf_cisco_aci_model,
6546 { "Model", "lldp.cisco.model", FT_STRING, BASE_NONE,
6547 NULL, 0x0, NULL, HFILL }
6549 { &hf_cisco_aci_nodename,
6550 { "Node Name", "lldp.cisco.nodename", FT_STRING, BASE_NONE,
6551 NULL, 0x0, NULL, HFILL }
6553 { &hf_cisco_aci_portmode,
6554 { "Port Mode", "lldp.cisco.portmode", FT_UINT8, BASE_NONE,
6555 VALS(cisco_portmode_vals), 0x0, NULL, HFILL }
6557 { &hf_cisco_aci_authcookie,
6558 { "Authentication Cookie", "lldp.cisco.authcookie", FT_BYTES, BASE_NONE,
6559 NULL, 0x0, NULL, HFILL }
6561 { &hf_cisco_aci_apicmode,
6562 { "APIC Mode", "lldp.cisco.apicmode", FT_UINT8, BASE_DEC,
6563 VALS(cisco_apicmode_vals), 0x0, NULL, HFILL }
6565 { &hf_cisco_aci_fabricid,
6566 { "Fabric ID", "lldp.cisco.fabricd", FT_UINT16, BASE_DEC,
6567 NULL, 0x0, NULL, HFILL }
6569 /* Hytec */
6570 { &hf_hytec_tlv_subtype,
6571 { "Hytec Subtype", "lldp.hytec.tlv_subtype", FT_UINT8, BASE_DEC,
6572 VALS(hytec_subtypes), 0x0, NULL, HFILL }
6574 { &hf_hytec_group,
6575 { "Group", "lldp.hytec.group", FT_UINT8, BASE_DEC,
6576 NULL, HYTEC_GROUP_MASK, NULL, HFILL }
6578 { &hf_hytec_identifier,
6579 { "Identifier", "lldp.hytec.identifier", FT_UINT8, BASE_DEC,
6580 NULL, HYTEC_IDENTIFIER_MASK, NULL, HFILL }
6582 { &hf_hytec_transceiver_vendor_product_revision,
6583 { HYTEC_TID__VENDOR_PRODUCT_REVISION_STR, "lldp.hytec.transceiver_vendor_product_revision", FT_STRING, BASE_NONE,
6584 NULL, 0x0, NULL, HFILL }
6586 { &hf_hytec_single_mode,
6587 { HYTEC_TBD__SINGLE_MODE_STR, "lldp.hytec.single_mode", FT_UINT32, BASE_DEC|BASE_UNIT_STRING,
6588 UNS(&units_meters), 0x0, NULL, HFILL}
6590 { &hf_hytec_multi_mode_50,
6591 { HYTEC_TBD__MULTI_MODE_50_STR, "lldp.hytec.multi_mode_50", FT_UINT32, BASE_DEC|BASE_UNIT_STRING,
6592 UNS(&units_meters), 0x0, NULL, HFILL}
6594 { &hf_hytec_multi_mode_62_5,
6595 { HYTEC_TBD__MULTI_MODE_62_5_STR, "lldp.hytec.multi_mode_62_5", FT_UINT32, BASE_DEC|BASE_UNIT_STRING,
6596 UNS(&units_meters), 0x0, NULL, HFILL}
6598 { &hf_hytec_tx_current_output_power,
6599 { HYTEC_MD__TX_CURRENT_OUTPUT_POWER_STR, "lldp.hytec.tx_current_output_power", FT_FLOAT, BASE_NONE|BASE_UNIT_STRING,
6600 UNS(&units_microwatt), 0x0, NULL, HFILL}
6602 { &hf_hytec_rx_current_input_power,
6603 { HYTEC_MD__RX_CURRENT_INPUT_POWER_STR, "lldp.hytec.rx_current_input_power", FT_FLOAT, BASE_NONE|BASE_UNIT_STRING,
6604 UNS(&units_microwatt), 0x0, NULL, HFILL}
6606 { &hf_hytec_rx_input_snr,
6607 { HYTEC_MD__RX_INPUT_SNR_STR, "lldp.hytec.rx_input_snr", FT_FLOAT, BASE_NONE|BASE_UNIT_STRING,
6608 UNS(&units_decibels), 0x0, NULL, HFILL}
6610 { &hf_hytec_lineloss,
6611 { HYTEC_MD__LINELOSS_STR, "lldp.hytec.lineloss", FT_FLOAT, BASE_NONE|BASE_UNIT_STRING,
6612 UNS(&units_decibels), 0x0, NULL, HFILL}
6614 { &hf_hytec_mac_trace_request,
6615 { HYTEC_MC__MAC_TRACE_REQUEST_STR, "lldp.hytec.mac_trace_request", FT_NONE, BASE_NONE,
6616 NULL, 0x0, NULL, HFILL}
6618 { &hf_hytec_trace_mac_address,
6619 { "Trace MAC address", "lldp.hytec.trace_mac_address", FT_ETHER, BASE_NONE,
6620 NULL, 0x0, NULL, HFILL}
6622 { &hf_hytec_request_mac_address,
6623 { "Requester's MAC address", "lldp.hytec.requesters_mac_address", FT_ETHER, BASE_NONE,
6624 NULL, 0x0, NULL, HFILL}
6626 { &hf_hytec_maximum_depth,
6627 { "Maximum depth", "lldp.hytec.maximum_depth", FT_UINT8, BASE_DEC,
6628 NULL, 0x0, NULL, HFILL}
6630 { &hf_hytec_mac_trace_reply,
6631 { HYTEC_MC__MAC_TRACE_REPLY_STR, "lldp.hytec.mac_trace_reply", FT_NONE, BASE_NONE,
6632 NULL, 0x0, NULL, HFILL}
6634 { &hf_hytec_answering_mac_address,
6635 { "Answering MAC address", "lldp.hytec.answering_mac_address", FT_ETHER, BASE_NONE,
6636 NULL, 0x0, NULL, HFILL}
6638 { &hf_hytec_actual_depth,
6639 { "Actual depth", "lldp.hytec.actual_depth", FT_UINT8, BASE_DEC,
6640 NULL, 0x0, NULL, HFILL}
6642 { &hf_hytec_name_of_replying_device,
6643 { HYTEC_MC__NAME_OF_REPLYING_DEVICE_STR, "lldp.hytec.name_of_replying_device", FT_STRING, BASE_NONE,
6644 NULL, 0x0, NULL, HFILL}
6646 { &hf_hytec_outgoing_port_name,
6647 { HYTEC_MC__OUTGOING_PORT_NAME_STR, "lldp.hytec.outgoing_port_name", FT_STRING, BASE_NONE,
6648 NULL, 0x0, NULL, HFILL}
6650 { &hf_hytec_ipv4_address_of_replying_device,
6651 { HYTEC_MC__IPV4_ADDRESS_OF_REPLYING_DEVICE_STR, "lldp.hytec.ipv4_address_of_replying_device", FT_IPv4, BASE_NONE,
6652 NULL, 0x0, NULL, HFILL}
6654 { &hf_hytec_end_of_trace,
6655 { HYTEC_MC__END_OF_TRACE_STR, "lldp.hytec.end_of_trace", FT_UINT8, BASE_HEX,
6656 NULL, 0x0, NULL, HFILL}
6658 { &hf_hytec_ipv6_address_of_replying_device,
6659 { HYTEC_MC__IPV6_ADDRESS_OF_REPLYING_DEVICE_STR, "lldp.hytec.ipv6_address_of_replying_device", FT_IPv6, BASE_NONE,
6660 NULL, 0x0, NULL, HFILL}
6662 { &hf_hytec_incoming_port_name,
6663 { HYTEC_MC__INCOMING_PORT_NAME_STR, "lldp.hytec.incoming_port_name", FT_STRING, BASE_NONE,
6664 NULL, 0x0, NULL, HFILL}
6666 { &hf_hytec_trace_identifier,
6667 { HYTEC_MC__TRACE_IDENTIFIER_STR, "lldp.hytec.trace_identifier", FT_UINT32, BASE_HEX,
6668 NULL, 0x0, NULL, HFILL}
6670 { &hf_hytec_invalid_object_data,
6671 { "Invalid object data", "lldp.hytec.invalid_object_data", FT_BYTES, BASE_NONE,
6672 NULL, 0x0, NULL, HFILL }
6674 { &hf_hytec_unknown_identifier_content,
6675 { "Unknown Identifier Content","lldp.hytec.unknown_identifier_content", FT_BYTES, BASE_NONE,
6676 NULL, 0x0, NULL, HFILL }
6678 { &hf_avaya_subtype,
6679 { "Avaya Subtype", "lldp.avaya.subtype", FT_UINT8, BASE_HEX,
6680 VALS(avaya_subtypes), 0x0, NULL, HFILL }
6682 { &hf_avaya_poe,
6683 { "PoE Conservation Level Support", "lldp.avaya.poe", FT_BYTES, BASE_NONE,
6684 NULL, 0x0, NULL, HFILL }
6686 { &hf_avaya_call_server,
6687 { "Call Server IP Address", "lldp.avaya.callserver", FT_IPv4, BASE_NONE,
6688 NULL, 0x0, NULL, HFILL }
6690 { &hf_avaya_cna_server,
6691 { "CNA Server IP Address", "lldp.avaya.cnaserver", FT_IPv4, BASE_NONE,
6692 NULL, 0x0, NULL, HFILL }
6694 { &hf_avaya_file_server,
6695 { "File Server", "lldp.avaya.fileserver", FT_IPv4, BASE_NONE,
6696 NULL, 0x0, NULL, HFILL }
6698 { &hf_avaya_dot1q,
6699 { "802.1Q Framing", "lldp.avaya.dot1q", FT_UINT8, BASE_HEX,
6700 VALS(avaya_dot1q_subtypes), 0x0, NULL, HFILL }
6702 { &hf_avaya_ipphone,
6703 { "IP Phone Addresses", "lldp.avaya.ipphone", FT_BYTES, BASE_NONE,
6704 NULL, 0x0, NULL, HFILL }
6706 { &hf_avaya_ipphone_ip,
6707 { "IP Address", "lldp.avaya.ipphone.ip", FT_IPv4, BASE_NONE,
6708 NULL, 0x0, NULL, HFILL }
6710 { &hf_avaya_ipphone_mask,
6711 { "Subnet Mask", "lldp.avaya.ipphone.mask", FT_IPv4, BASE_NONE,
6712 NULL, 0x0, NULL, HFILL }
6714 { &hf_avaya_ipphone_gateway,
6715 { "Gateway IP", "lldp.avaya.ipphone.gateway", FT_IPv4, BASE_NONE,
6716 NULL, 0x0, NULL, HFILL }
6718 { &hf_iana_subtype,
6719 { "IANA Subtype", "lldp.iana.subtype", FT_UINT8, BASE_HEX,
6720 VALS(iana_subtypes), 0x0, NULL, HFILL }
6722 { &hf_iana_mudurl,
6723 { "Manufacturer Usage Description URL", "lldp.iana.mudurl", FT_STRING, BASE_NONE,
6724 NULL, 0x0, NULL, HFILL }
6726 { &hf_onos_subtype,
6727 { "ONOS Subtype", "lldp.onos.subtype", FT_UINT8, BASE_HEX,
6728 VALS(onos_subtypes), 0x0, NULL, HFILL }
6730 { &hf_onos_chassis,
6731 { "Chassis", "lldp.onos.chassis", FT_STRING, BASE_NONE,
6732 NULL, 0x0, NULL, HFILL }
6734 { &hf_onos_port,
6735 { "Port", "lldp.onos.port", FT_STRING, BASE_NONE,
6736 NULL, 0x0, NULL, HFILL }
6738 { &hf_onos_ttl,
6739 { "ttl", "lldp.onos.ttl", FT_UINT32, BASE_DEC,
6740 NULL, 0x0, NULL, HFILL }
6742 { &hf_unknown_subtype,
6743 { "Unknown Subtype","lldp.unknown_subtype", FT_UINT8, BASE_DEC,
6744 NULL, 0x0, NULL, HFILL }
6746 { &hf_unknown_subtype_content,
6747 { "Unknown Subtype Content","lldp.unknown_subtype.content", FT_BYTES, BASE_NONE,
6748 NULL, 0x0, NULL, HFILL }
6750 { &hf_subtype_content_remaining,
6751 { "Subtype Unknown Trailing Bytes","lldp.subtype.content_remaining", FT_BYTES, BASE_NONE,
6752 NULL, 0x0, NULL, HFILL }
6754 { &hf_ex_avaya_tlv_subtype,
6755 { "Subtype", "lldp.extreme_avaya_ap.subtype", FT_UINT8, BASE_DEC,
6756 VALS(ex_avaya_subtypes), 0x0, NULL, HFILL }
6758 { &hf_ex_avaya_hmac_shi,
6759 { "HMAC-SHA Digest", "lldp.extreme_avaya_ap.hmac_sha_digest", FT_BYTES, BASE_NONE,
6760 NULL, 0x0, NULL, HFILL }
6762 { &hf_ex_avaya_element_type,
6763 { "Element Type", "lldp.extreme_avaya_ap.element_type", FT_UINT24, BASE_DEC,
6764 NULL, 0xfc0000, NULL, HFILL }
6766 { &hf_ex_avaya_state,
6767 { "State", "lldp.extreme_avaya_ap.state", FT_UINT24, BASE_DEC,
6768 NULL, 0x03f000, NULL, HFILL }
6770 { &hf_ex_avaya_mgnt_vlan,
6771 { "Mgmt VLAN", "lldp.extreme_avaya_ap.mgnt_vlan", FT_UINT24, BASE_DEC,
6772 NULL, 0x000fff, NULL, HFILL }
6774 { &hf_ex_avaya_vlan,
6775 { "VLAN", "lldp.extreme_avaya_ap.vlan", FT_UINT16, BASE_DEC,
6776 NULL, 0x0fff, NULL, HFILL }
6778 { &hf_ex_avaya_rsvd,
6779 { "Reserved", "lldp.extreme_avaya_ap.rsvd", FT_UINT8, BASE_DEC,
6780 NULL, 0x0, NULL, HFILL }
6782 { &hf_ex_avaya_system_id,
6783 { "System ID", "lldp.extreme_avaya_ap.system_id", FT_BYTES, SEP_COLON,
6784 NULL, 0x0, NULL, HFILL }
6786 { &hf_ex_avaya_status,
6787 { "Assignment Status", "lldp.extreme_avaya_ap.status", FT_UINT16, BASE_DEC,
6788 NULL, 0xf000, NULL, HFILL }
6790 { &hf_ex_avaya_i_sid,
6791 { "I-SID", "lldp.extreme_avaya_ap.i_sid", FT_UINT24, BASE_DEC,
6792 NULL, 0x0, NULL, HFILL }
6794 { &hf_ex_avaya2_tlv_subtype,
6795 { "Subtype", "lldp.extreme_avaya.fabric.subtype", FT_UINT8, BASE_DEC,
6796 VALS(ex_avaya2_subtypes), 0x0, NULL, HFILL }
6798 { &hf_ex_avaya2_fabric_connect,
6799 { "FC Capability", "lldp.extreme_avaya.fabric.fabric_connect", FT_BOOLEAN, BASE_NONE,
6800 TFS(&tfs_enabled_disabled), 0x0, "Fabric Connect aka auto-sense", HFILL }
6802 { &hf_ex_avaya2_fabric_numbvlans,
6803 { "Number B-VLANs", "lldp.extreme_avaya.fabric.numbvlans", FT_UINT8, BASE_DEC,
6804 NULL, 0x0, NULL, HFILL }
6806 { &hf_ex_avaya2_fabric_bvlanid,
6807 { "B-VLAN ID", "lldp.extreme_avaya.fabric.bvlanid", FT_UINT16, BASE_DEC,
6808 NULL, 0x0, NULL, HFILL }
6810 { &hf_ex_avaya2_fabric_sysidlength,
6811 { "SysID Length", "lldp.extreme_avaya.fabric.sysidlength", FT_UINT8, BASE_DEC,
6812 NULL, 0x0, NULL, HFILL }
6814 { &hf_ex_avaya2_fabric_sysid,
6815 { "System ID", "lldp.extreme_avaya.fabric.sysid", FT_SYSTEM_ID, BASE_NONE,
6816 NULL, 0x0, NULL, HFILL }
6820 /* Setup protocol subtree array */
6821 static int *ett[] = {
6822 &ett_lldp,
6823 &ett_chassis_id,
6824 &ett_port_id,
6825 &ett_time_to_live,
6826 &ett_end_of_lldpdu,
6827 &ett_port_description,
6828 &ett_system_name,
6829 &ett_system_desc,
6830 &ett_system_cap,
6831 &ett_system_cap_summary,
6832 &ett_system_cap_enabled,
6833 &ett_management_address,
6834 &ett_unknown_tlv,
6835 &ett_org_spc_tlv,
6836 &ett_org_spc_def,
6837 &ett_org_spc_dcbx_cin,
6838 &ett_org_spc_dcbx_cee,
6839 &ett_org_spc_dcbx_cee_1,
6840 &ett_org_spc_dcbx_cee_2,
6841 &ett_org_spc_dcbx_cee_3,
6842 &ett_org_spc_dcbx_cee_4,
6843 &ett_org_spc_dcbx_cin_6,
6844 &ett_org_spc_dcbx_cee_app,
6845 &ett_org_spc_ieee_802_1_1,
6846 &ett_org_spc_ieee_802_1_2,
6847 &ett_org_spc_ieee_802_1_3,
6848 &ett_org_spc_ieee_802_1_4,
6849 &ett_org_spc_ieee_802_1_8,
6850 &ett_org_spc_ieee_802_1_9,
6851 &ett_org_spc_ieee_802_1_a,
6852 &ett_org_spc_ieee_802_1_b,
6853 &ett_org_spc_ieee_802_1_c,
6854 &ett_org_spc_ieee_dcbx_app,
6855 &ett_org_spc_ieee_802_3_1,
6856 &ett_org_spc_ieee_802_3_2,
6857 &ett_org_spc_ieee_802_3_3,
6858 &ett_org_spc_ieee_802_3_4,
6859 &ett_org_spc_ieee_802_3_5,
6860 &ett_org_spc_ieee_802_3_7,
6861 &ett_org_spc_media_1,
6862 &ett_org_spc_media_2,
6863 &ett_org_spc_media_3,
6864 &ett_org_spc_media_4,
6865 &ett_org_spc_media_5,
6866 &ett_org_spc_media_6,
6867 &ett_org_spc_media_7,
6868 &ett_org_spc_media_8,
6869 &ett_org_spc_media_9,
6870 &ett_org_spc_media_10,
6871 &ett_org_spc_media_11,
6872 &ett_org_spc_ProfinetSubTypes_1,
6873 &ett_org_spc_ProfinetSubTypes_2,
6874 &ett_org_spc_ProfinetSubTypes_3,
6875 &ett_org_spc_ProfinetSubTypes_4,
6876 &ett_org_spc_ProfinetSubTypes_5,
6877 &ett_org_spc_ProfinetSubTypes_6,
6878 &ett_port_vlan_flags,
6879 &ett_802_3_flags,
6880 &ett_802_3_autoneg_advertised,
6881 &ett_802_3_power,
6882 &ett_802_3_bt_power,
6883 &ett_802_3_bt_system_setup,
6884 &ett_802_3_bt_autoclass,
6885 &ett_802_3_bt_power_down,
6886 &ett_802_3_aggregation,
6887 &ett_802_1_aggregation,
6888 &ett_802_1qbg_capabilities_flags,
6889 &ett_802_3br_capabilities_flags,
6890 &ett_media_capabilities,
6891 &ett_profinet_period,
6892 &ett_cisco_upoe_tlv,
6893 &ett_avaya_ipphone_tlv,
6894 &ett_org_spc_hytec_subtype_transceiver,
6895 &ett_org_spc_hytec_subtype_trace,
6896 &ett_org_spc_hytec_trace_request,
6897 &ett_org_spc_hytec_trace_reply,
6898 &ett_ex_avayaSubTypes_11,
6899 &ett_ex_avayaSubTypes_12,
6900 &ett_ex_avaya2SubTypes_4
6903 static ei_register_info ei[] = {
6904 { &ei_lldp_bad_length, { "lldp.incorrect_length", PI_MALFORMED, PI_WARN, "Invalid length, too short", EXPFILL }},
6905 { &ei_lldp_bad_length_excess, { "lldp.excess_length", PI_MALFORMED, PI_WARN, "Invalid length, greater than expected", EXPFILL }},
6906 { &ei_lldp_shutdown_excess_tlv, { "lldp.excess_tlv", PI_MALFORMED, PI_WARN, "Excess TLV in Shutdown PDU", EXPFILL }},
6907 { &ei_lldp_bad_type, { "lldp.bad_type", PI_MALFORMED, PI_WARN, "Incorrect type", EXPFILL }},
6908 { &ei_lldp_tlv_deprecated, { "lldp.tlv_deprecated", PI_PROTOCOL, PI_WARN, "TLV has been deprecated", EXPFILL }},
6911 static const enum_val_t column_info_options[] = {
6912 { "default_column_info", "Default Column Info", DEFAULT_COLUMN_INFO },
6913 { "profinet_special_column_info", "PROFINET Special Column Info", PROFINET_SPECIAL_COLUMN_INFO },
6914 { NULL, NULL, 0 }
6917 /* Register the protocol name and description */
6918 proto_lldp = proto_register_protocol("Link Layer Discovery Protocol", "LLDP", "lldp");
6919 lldp_handle = register_dissector("lldp", dissect_lldp, proto_lldp);
6921 /* Register preferences */
6922 lldp_module = prefs_register_protocol(proto_lldp, NULL);
6924 prefs_register_enum_preference(lldp_module,
6925 "column_info_selection",
6926 "Select Column Info Display Style",
6927 "Which Information will be showed at Column Information is decided by the selection",
6928 &column_info_selection,
6929 column_info_options,
6930 false);
6932 prefs_register_bool_preference(lldp_module,
6933 "assume_unrecognized_tlv",
6934 "Assume unrecognized TLV",
6935 "If checked, assume an unrecognized TLV type should be consumed and treated as an LLDP TLV. Otherwise, end LLDP dissection.",
6936 &assume_unrecognized_tlv);
6938 /* Required function calls to register the header fields and subtrees used */
6939 proto_register_field_array(proto_lldp, hf, array_length(hf));
6940 proto_register_subtree_array(ett, array_length(ett));
6941 oui_unique_code_table = register_dissector_table("lldp.orgtlv.oui", "LLDP OUI", proto_lldp, FT_UINT24, BASE_HEX );
6943 expert_lldp = expert_register_protocol(proto_lldp);
6944 expert_register_field_array(expert_lldp, ei, array_length(ei));
6947 void
6948 proto_reg_handoff_lldp(void)
6950 dissector_add_uint("ethertype", ETHERTYPE_LLDP, lldp_handle);
6951 dissector_add_uint("ethertype", ETHERTYPE_ONOS, lldp_handle);
6955 * Editor modelines - https://www.wireshark.org/tools/modelines.html
6957 * Local variables:
6958 * c-basic-offset: 8
6959 * tab-width: 8
6960 * indent-tabs-mode: t
6961 * End:
6963 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
6964 * :indentSize=8:tabSize=8:noTabs=false: