2 * Routines for Veritas Low Latency Transport (LLT) dissection
3 * Copyright 2006, Stephen Fisher (see AUTHORS file)
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
14 #include <epan/packet.h>
15 #include <epan/prefs.h>
16 #include <epan/etypes.h>
18 void proto_register_llt(void);
19 void proto_reg_handoff_llt(void);
21 static const value_string message_type_vs[] = {
22 { 0x0a, "heartbeat" },
26 /* Variables for our preferences */
27 static guint preference_alternate_ethertype = 0x0;
29 /* Initialize the protocol and registered fields */
30 static int proto_llt = -1;
32 static int hf_llt_cluster_num = -1;
33 static int hf_llt_node_id = -1;
34 static int hf_llt_message_type = -1;
35 static int hf_llt_sequence_num = -1;
36 static int hf_llt_message_time = -1;
38 /* Initialize the subtree pointers */
39 static gint ett_llt = -1;
41 /* Code to actually dissect the packets */
43 dissect_llt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
45 /* Set up structures needed to add the protocol subtree and manage it */
50 /* Make entries in Protocol column and Info column on summary display */
51 col_set_str(pinfo->cinfo, COL_PROTOCOL, "LLT");
53 message_type = tvb_get_guint8(tvb, 3);
55 col_add_fstr(pinfo->cinfo, COL_INFO, "Message type: %s", val_to_str(message_type, message_type_vs, "Unknown (0x%02x)"));
57 ti = proto_tree_add_item(tree, proto_llt, tvb, 0, -1, ENC_NA);
58 llt_tree = proto_item_add_subtree(ti, ett_llt);
60 proto_tree_add_item(llt_tree, hf_llt_cluster_num, tvb, 2, 1, ENC_BIG_ENDIAN);
61 proto_tree_add_item(llt_tree, hf_llt_message_type, tvb, 3, 1, ENC_BIG_ENDIAN);
62 proto_tree_add_item(llt_tree, hf_llt_node_id, tvb, 7, 1, ENC_BIG_ENDIAN);
63 proto_tree_add_item(llt_tree, hf_llt_sequence_num, tvb, 24, 4, ENC_BIG_ENDIAN);
64 proto_tree_add_item(llt_tree, hf_llt_message_time, tvb, 40, 4, ENC_BIG_ENDIAN);
66 return tvb_captured_length(tvb);
69 /* Register the protocol with Wireshark */
71 proto_register_llt(void)
75 static hf_register_info hf[] = {
77 { &hf_llt_cluster_num, { "Cluster number", "llt.cluster_num",
78 FT_UINT8, BASE_DEC, NULL, 0,
79 "Cluster number that this node belongs to", HFILL } },
81 { &hf_llt_message_type, { "Message type", "llt.message_type",
82 FT_UINT8, BASE_HEX, VALS(message_type_vs), 0,
83 "Type of LLT message contained in this frame", HFILL } },
85 { &hf_llt_node_id, { "Node ID", "llt.node_id",
86 FT_UINT8, BASE_DEC, NULL, 0,
87 "Number identifying this node within the cluster", HFILL } },
89 { &hf_llt_sequence_num, { "Sequence number", "llt.sequence_num",
90 FT_UINT32, BASE_DEC, NULL, 0,
91 "Sequence number of this frame", HFILL } },
93 { &hf_llt_message_time, { "Message time", "llt.message_time",
94 FT_UINT32, BASE_DEC, NULL, 0,
95 "Number of ticks since this node was last rebooted", HFILL } }
98 /* Setup protocol subtree array */
99 static gint *ett[] = {
103 /* Register the protocol name and description */
104 proto_llt = proto_register_protocol("Veritas Low Latency Transport (LLT)", "LLT", "llt");
106 /* Required function calls to register the header fields and subtrees used */
107 proto_register_field_array(proto_llt, hf, array_length(hf));
108 proto_register_subtree_array(ett, array_length(ett));
110 /* Register preferences module */
111 llt_module = prefs_register_protocol(proto_llt, proto_reg_handoff_llt);
113 /* Register our preferences */
114 prefs_register_uint_preference(llt_module, "alternate_ethertype", "Alternate ethertype value (in hex)",
115 "Dissect this ethertype as LLT traffic in addition to the default, 0xCAFE.",
116 16, &preference_alternate_ethertype); /* A base-16 (hexadecimal) value */
122 proto_reg_handoff_llt(void)
124 static gboolean initialized = FALSE;
125 static dissector_handle_t llt_handle;
126 static guint preference_alternate_ethertype_last;
129 llt_handle = create_dissector_handle(dissect_llt, proto_llt);
130 dissector_add_uint("ethertype", ETHERTYPE_LLT, llt_handle);
133 if (preference_alternate_ethertype_last != 0x0) {
134 dissector_delete_uint("ethertype", preference_alternate_ethertype_last, llt_handle);
138 /* Save the setting to see if it has changed later */
139 preference_alternate_ethertype_last = preference_alternate_ethertype;
141 if (preference_alternate_ethertype != 0x0) {
142 /* Register the new ethertype setting */
143 dissector_add_uint("ethertype", preference_alternate_ethertype, llt_handle);
148 * Editor modelines - http://www.wireshark.org/tools/modelines.html
153 * indent-tabs-mode: t
156 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
157 * :indentSize=8:tabSize=8:noTabs=false: