2008-05-14 05:44:42 +00:00
|
|
|
/* packet-cimetrics.c
|
|
|
|
* Routines for Cimetrics LLC OUI dissection
|
|
|
|
* Copyright 2008 Steve Karg <skarg@users.sourceforge.net> Alabama
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-12 11:23:27 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2008-05-14 05:44:42 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2008-05-14 05:44:42 +00:00
|
|
|
|
|
|
|
#include <epan/packet.h>
|
|
|
|
#include "packet-llc.h"
|
|
|
|
#include <epan/oui.h>
|
|
|
|
#include "packet-mstp.h"
|
|
|
|
|
2013-03-15 06:26:47 +00:00
|
|
|
void proto_register_cimetrics(void);
|
|
|
|
void proto_reg_handoff_cimetrics(void);
|
|
|
|
|
2008-05-20 06:52:22 +00:00
|
|
|
/* Probably should be a preference, but here for now */
|
|
|
|
#define BACNET_MSTP_SUMMARY_IN_TREE
|
|
|
|
|
2008-05-14 05:44:42 +00:00
|
|
|
/* the U+4 device does MS/TP, uLAN, Modbus */
|
|
|
|
static const value_string cimetrics_pid_vals[] = {
|
|
|
|
{ 0x0001, "U+4 MS/TP" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int proto_cimetrics_mstp = -1;
|
|
|
|
static int hf_llc_cimetrics_pid = -1;
|
|
|
|
static gint ett_cimetrics_mstp = -1;
|
|
|
|
|
|
|
|
static int hf_cimetrics_mstp_timer = -1;
|
|
|
|
static int hf_cimetrics_mstp_value = -1;
|
|
|
|
|
2016-12-17 01:06:11 +00:00
|
|
|
static dissector_handle_t cimetric_handle;
|
2008-05-14 05:44:42 +00:00
|
|
|
|
2015-11-10 04:01:28 +00:00
|
|
|
static int
|
|
|
|
dissect_cimetrics_mstp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
|
2008-05-14 05:44:42 +00:00
|
|
|
{
|
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *subtree;
|
|
|
|
gint offset = 0;
|
2008-05-20 06:52:22 +00:00
|
|
|
#ifdef BACNET_MSTP_SUMMARY_IN_TREE
|
|
|
|
guint8 mstp_frame_type = 0;
|
|
|
|
guint8 mstp_frame_source = 0;
|
|
|
|
guint8 mstp_frame_destination = 0;
|
|
|
|
#endif
|
2008-05-14 05:44:42 +00:00
|
|
|
|
2008-05-20 06:52:22 +00:00
|
|
|
#ifdef BACNET_MSTP_SUMMARY_IN_TREE
|
|
|
|
mstp_frame_type = tvb_get_guint8(tvb, offset+3);
|
|
|
|
mstp_frame_destination = tvb_get_guint8(tvb, offset+4);
|
|
|
|
mstp_frame_source = tvb_get_guint8(tvb, offset+5);
|
|
|
|
ti = proto_tree_add_protocol_format(tree,
|
|
|
|
proto_cimetrics_mstp, tvb, offset, 9,
|
|
|
|
"BACnet MS/TP, Src (%u), Dst (%u), %s",
|
|
|
|
mstp_frame_source, mstp_frame_destination,
|
|
|
|
mstp_frame_type_text(mstp_frame_type));
|
|
|
|
#else
|
2011-10-21 02:10:19 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_cimetrics_mstp, tvb, offset, 9, ENC_NA);
|
2008-05-20 06:52:22 +00:00
|
|
|
#endif
|
2008-05-14 05:44:42 +00:00
|
|
|
subtree = proto_item_add_subtree(ti, ett_cimetrics_mstp);
|
|
|
|
proto_tree_add_item(subtree, hf_cimetrics_mstp_timer, tvb,
|
2011-10-06 03:35:44 +00:00
|
|
|
offset++, 2, ENC_LITTLE_ENDIAN);
|
2008-05-14 05:44:42 +00:00
|
|
|
offset++;
|
|
|
|
proto_tree_add_item(subtree, hf_cimetrics_mstp_value, tvb,
|
2011-10-06 03:35:44 +00:00
|
|
|
offset++, 1, ENC_LITTLE_ENDIAN);
|
2008-05-14 05:44:42 +00:00
|
|
|
dissect_mstp(tvb, pinfo, tree, subtree, offset);
|
2015-11-10 04:01:28 +00:00
|
|
|
return tvb_captured_length(tvb);
|
2008-05-14 05:44:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_cimetrics(void)
|
|
|
|
{
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_cimetrics_mstp_timer,
|
2014-10-05 19:57:05 +00:00
|
|
|
{ "Delta Time", "cimetrics.mstp_timer",
|
|
|
|
FT_UINT16, BASE_DEC, NULL, 0,
|
|
|
|
"Milliseconds", HFILL }
|
2008-05-14 05:44:42 +00:00
|
|
|
},
|
|
|
|
{ &hf_cimetrics_mstp_value,
|
2014-10-05 19:57:05 +00:00
|
|
|
{ "8-bit value", "cimetrics.mstp_value",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0,
|
|
|
|
"value", HFILL }
|
2008-05-14 05:44:42 +00:00
|
|
|
}
|
|
|
|
};
|
2009-06-24 02:11:11 +00:00
|
|
|
static hf_register_info hf2[] = {
|
2014-10-05 19:57:05 +00:00
|
|
|
{ &hf_llc_cimetrics_pid,
|
|
|
|
{ "PID", "llc.cimetrics_pid",
|
|
|
|
FT_UINT16, BASE_HEX, VALS(cimetrics_pid_vals), 0,
|
|
|
|
NULL, HFILL }
|
|
|
|
}
|
2008-05-14 05:44:42 +00:00
|
|
|
};
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_cimetrics_mstp
|
|
|
|
};
|
|
|
|
|
|
|
|
proto_cimetrics_mstp = proto_register_protocol("Cimetrics MS/TP",
|
2014-10-05 19:57:05 +00:00
|
|
|
"Cimetrics MS/TP", "cimetrics");
|
2008-05-14 05:44:42 +00:00
|
|
|
|
|
|
|
proto_register_field_array(proto_cimetrics_mstp, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
|
2016-12-17 01:06:11 +00:00
|
|
|
cimetric_handle = register_dissector("cimetrics", dissect_cimetrics_mstp, proto_cimetrics_mstp);
|
2011-10-21 02:10:19 +00:00
|
|
|
|
2008-05-14 05:44:42 +00:00
|
|
|
llc_add_oui(OUI_CIMETRICS, "llc.cimetrics_pid",
|
2016-03-13 11:51:45 +00:00
|
|
|
"LLC Cimetrics OUI PID", hf2, proto_cimetrics_mstp);
|
2008-05-14 05:44:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_cimetrics(void)
|
|
|
|
{
|
2016-12-17 01:06:11 +00:00
|
|
|
dissector_add_uint("llc.cimetrics_pid", 1, cimetric_handle);
|
2008-05-14 05:44:42 +00:00
|
|
|
}
|
2014-10-05 19:57:05 +00:00
|
|
|
|
|
|
|
/*
|
2019-07-26 18:43:17 +00:00
|
|
|
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
2014-10-05 19:57:05 +00:00
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 8
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: t
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
|
|
|
|
* :indentSize=8:tabSize=8:noTabs=false:
|
|
|
|
*/
|