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 dissector_handle_t llt_handle
;
23 static const value_string message_type_vs
[] = {
24 { 0x0a, "heartbeat" },
28 /* Variables for our preferences */
29 static unsigned preference_alternate_ethertype
= 0x0;
31 /* Initialize the protocol and registered fields */
34 static int hf_llt_cluster_num
;
35 static int hf_llt_node_id
;
36 static int hf_llt_message_type
;
37 static int hf_llt_sequence_num
;
38 static int hf_llt_message_time
;
39 static int hf_llt_dst_node_id
;
40 static int hf_llt_src_node_id
;
42 /* Initialize the subtree pointers */
45 /* Code to actually dissect the packets */
47 dissect_llt(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
49 /* Set up structures needed to add the protocol subtree and manage it */
55 /* Make entries in Protocol column and Info column on summary display */
56 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "LLT");
58 magic
= tvb_get_uint16(tvb
, 0, ENC_BIG_ENDIAN
);
59 if(magic
== 0x0602){ /* v2 ? */
61 ti
= proto_tree_add_item(tree
, proto_llt
, tvb
, 0, -1, ENC_NA
);
62 llt_tree
= proto_item_add_subtree(ti
, ett_llt
);
64 proto_tree_add_item(llt_tree
, hf_llt_cluster_num
, tvb
, 2, 2, ENC_LITTLE_ENDIAN
);
65 proto_tree_add_item(llt_tree
, hf_llt_dst_node_id
, tvb
, 6, 1, ENC_LITTLE_ENDIAN
);
66 proto_tree_add_item(llt_tree
, hf_llt_src_node_id
, tvb
, 8, 1, ENC_LITTLE_ENDIAN
);
69 message_type
= tvb_get_uint8(tvb
, 3);
71 col_add_fstr(pinfo
->cinfo
, COL_INFO
, "Message type: %s", val_to_str(message_type
, message_type_vs
, "Unknown (0x%02x)"));
73 ti
= proto_tree_add_item(tree
, proto_llt
, tvb
, 0, -1, ENC_NA
);
74 llt_tree
= proto_item_add_subtree(ti
, ett_llt
);
76 proto_tree_add_item(llt_tree
, hf_llt_cluster_num
, tvb
, 2, 1, ENC_BIG_ENDIAN
);
77 proto_tree_add_item(llt_tree
, hf_llt_message_type
, tvb
, 3, 1, ENC_BIG_ENDIAN
);
78 proto_tree_add_item(llt_tree
, hf_llt_node_id
, tvb
, 7, 1, ENC_BIG_ENDIAN
);
79 proto_tree_add_item(llt_tree
, hf_llt_sequence_num
, tvb
, 24, 4, ENC_BIG_ENDIAN
);
80 proto_tree_add_item(llt_tree
, hf_llt_message_time
, tvb
, 40, 4, ENC_BIG_ENDIAN
);
82 return tvb_captured_length(tvb
);
85 /* Register the protocol with Wireshark */
87 proto_register_llt(void)
91 static hf_register_info hf
[] = {
93 { &hf_llt_cluster_num
, { "Cluster number", "llt.cluster_num",
94 FT_UINT16
, BASE_DEC
, NULL
, 0,
95 "Cluster number that this node belongs to", HFILL
} },
97 { &hf_llt_message_type
, { "Message type", "llt.message_type",
98 FT_UINT8
, BASE_HEX
, VALS(message_type_vs
), 0,
99 "Type of LLT message contained in this frame", HFILL
} },
101 { &hf_llt_node_id
, { "Node ID", "llt.node_id",
102 FT_UINT8
, BASE_DEC
, NULL
, 0,
103 "Number identifying this node within the cluster", HFILL
} },
105 { &hf_llt_sequence_num
, { "Sequence number", "llt.sequence_num",
106 FT_UINT32
, BASE_DEC
, NULL
, 0,
107 "Sequence number of this frame", HFILL
} },
109 { &hf_llt_message_time
, { "Message time", "llt.message_time",
110 FT_UINT32
, BASE_DEC
, NULL
, 0,
111 "Number of ticks since this node was last rebooted", HFILL
} },
113 { &hf_llt_dst_node_id
, { "Destination Node ID", "llt.dst.node_id",
114 FT_UINT8
, BASE_DEC
, NULL
, 0,
115 "Number identifying destination node within the cluster", HFILL
} },
117 { &hf_llt_src_node_id
, { "Source Node ID", "llt.src.node_id",
118 FT_UINT8
, BASE_DEC
, NULL
, 0,
119 "Number identifying source node within the cluster", HFILL
} },
123 /* Setup protocol subtree array */
124 static int *ett
[] = {
128 /* Register the protocol name and description */
129 proto_llt
= proto_register_protocol("Veritas Low Latency Transport (LLT)", "LLT", "llt");
131 /* Required function calls to register the header fields and subtrees used */
132 proto_register_field_array(proto_llt
, hf
, array_length(hf
));
133 proto_register_subtree_array(ett
, array_length(ett
));
135 /* Register preferences module */
136 llt_module
= prefs_register_protocol(proto_llt
, proto_reg_handoff_llt
);
138 /* Register our preferences */
139 prefs_register_uint_preference(llt_module
, "alternate_ethertype", "Alternate ethertype value (in hex)",
140 "Dissect this ethertype as LLT traffic in addition to the default, 0xCAFE.",
141 16, &preference_alternate_ethertype
); /* A base-16 (hexadecimal) value */
143 /* Register our dissector */
144 llt_handle
= register_dissector("llt", dissect_llt
, proto_llt
);
149 proto_reg_handoff_llt(void)
151 static bool initialized
= false;
152 static unsigned preference_alternate_ethertype_last
;
155 dissector_add_uint("ethertype", ETHERTYPE_LLT
, llt_handle
);
158 if (preference_alternate_ethertype_last
!= 0x0) {
159 dissector_delete_uint("ethertype", preference_alternate_ethertype_last
, llt_handle
);
163 /* Save the setting to see if it has changed later */
164 preference_alternate_ethertype_last
= preference_alternate_ethertype
;
166 if (preference_alternate_ethertype
!= 0x0) {
167 /* Register the new ethertype setting */
168 dissector_add_uint("ethertype", preference_alternate_ethertype
, llt_handle
);
173 * Editor modelines - https://www.wireshark.org/tools/modelines.html
178 * indent-tabs-mode: t
181 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
182 * :indentSize=8:tabSize=8:noTabs=false: