2 * Routines for Cimetrics LLC OUI dissection
3 * Copyright 2008 Steve Karg <skarg@users.sourceforge.net> Alabama
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 "packet-llc.h"
17 #include "packet-mstp.h"
19 void proto_register_cimetrics(void);
20 void proto_reg_handoff_cimetrics(void);
22 /* Probably should be a preference, but here for now */
23 #define BACNET_MSTP_SUMMARY_IN_TREE
25 /* the U+4 device does MS/TP, uLAN, Modbus */
26 static const value_string cimetrics_pid_vals
[] = {
27 { 0x0001, "U+4 MS/TP" },
31 static int proto_cimetrics_mstp
;
32 static int hf_llc_cimetrics_pid
;
33 static int ett_cimetrics_mstp
;
35 static int hf_cimetrics_mstp_timer
;
36 static int hf_cimetrics_mstp_value
;
38 static dissector_handle_t cimetric_handle
;
41 dissect_cimetrics_mstp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
46 #ifdef BACNET_MSTP_SUMMARY_IN_TREE
47 uint8_t mstp_frame_type
= 0;
48 uint8_t mstp_frame_source
= 0;
49 uint8_t mstp_frame_destination
= 0;
52 #ifdef BACNET_MSTP_SUMMARY_IN_TREE
53 mstp_frame_type
= tvb_get_uint8(tvb
, offset
+3);
54 mstp_frame_destination
= tvb_get_uint8(tvb
, offset
+4);
55 mstp_frame_source
= tvb_get_uint8(tvb
, offset
+5);
56 ti
= proto_tree_add_protocol_format(tree
,
57 proto_cimetrics_mstp
, tvb
, offset
, 9,
58 "BACnet MS/TP, Src (%u), Dst (%u), %s",
59 mstp_frame_source
, mstp_frame_destination
,
60 mstp_frame_type_text(mstp_frame_type
));
62 ti
= proto_tree_add_item(tree
, proto_cimetrics_mstp
, tvb
, offset
, 9, ENC_NA
);
64 subtree
= proto_item_add_subtree(ti
, ett_cimetrics_mstp
);
65 proto_tree_add_item(subtree
, hf_cimetrics_mstp_timer
, tvb
,
66 offset
++, 2, ENC_LITTLE_ENDIAN
);
68 proto_tree_add_item(subtree
, hf_cimetrics_mstp_value
, tvb
,
69 offset
++, 1, ENC_LITTLE_ENDIAN
);
70 dissect_mstp(tvb
, pinfo
, tree
, subtree
, offset
);
71 return tvb_captured_length(tvb
);
75 proto_register_cimetrics(void)
77 static hf_register_info hf
[] = {
78 { &hf_cimetrics_mstp_timer
,
79 { "Delta Time", "cimetrics.mstp_timer",
80 FT_UINT16
, BASE_DEC
, NULL
, 0,
81 "Milliseconds", HFILL
}
83 { &hf_cimetrics_mstp_value
,
84 { "8-bit value", "cimetrics.mstp_value",
85 FT_UINT8
, BASE_DEC
, NULL
, 0,
89 static hf_register_info hf2
[] = {
90 { &hf_llc_cimetrics_pid
,
91 { "PID", "llc.cimetrics_pid",
92 FT_UINT16
, BASE_HEX
, VALS(cimetrics_pid_vals
), 0,
100 proto_cimetrics_mstp
= proto_register_protocol("Cimetrics MS/TP",
101 "Cimetrics MS/TP", "cimetrics");
103 proto_register_field_array(proto_cimetrics_mstp
, hf
, array_length(hf
));
104 proto_register_subtree_array(ett
, array_length(ett
));
106 cimetric_handle
= register_dissector("cimetrics", dissect_cimetrics_mstp
, proto_cimetrics_mstp
);
108 llc_add_oui(OUI_CIMETRICS
, "llc.cimetrics_pid",
109 "LLC Cimetrics OUI PID", hf2
, proto_cimetrics_mstp
);
113 proto_reg_handoff_cimetrics(void)
115 dissector_add_uint("llc.cimetrics_pid", 1, cimetric_handle
);
119 * Editor modelines - https://www.wireshark.org/tools/modelines.html
124 * indent-tabs-mode: t
127 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
128 * :indentSize=8:tabSize=8:noTabs=false: