2009-05-02 21:51:51 +00:00
|
|
|
/* packet-mesh-header.c
|
|
|
|
* Routines for Mesh Header dissection
|
|
|
|
* Javier Cardona <javier@cozybit.com>
|
|
|
|
* Copyright 2007, Marvell Semiconductors Inc.
|
|
|
|
*
|
|
|
|
* 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
|
2009-05-02 21:51:51 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2009-05-02 21:51:51 +00:00
|
|
|
|
|
|
|
#include <epan/packet.h>
|
|
|
|
|
2013-12-14 16:09:57 +00:00
|
|
|
void proto_register_mesh(void);
|
|
|
|
|
2009-05-02 21:51:51 +00:00
|
|
|
/* Initialize the protocol and registered fields */
|
|
|
|
static int proto_mesh = -1;
|
|
|
|
static int hf_mesh_ttl = -1;
|
|
|
|
static int hf_mesh_e2eseq = -1;
|
|
|
|
|
|
|
|
/* Initialize the subtree pointers */
|
|
|
|
static gint ett_mesh = -1;
|
|
|
|
|
|
|
|
/* Code to actually dissect the packets */
|
|
|
|
static int
|
2012-09-10 21:40:21 +00:00
|
|
|
dissect_mesh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
2009-05-02 21:51:51 +00:00
|
|
|
{
|
|
|
|
/* Set up structures needed to add the protocol subtree and manage it */
|
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *mesh_tree;
|
2011-10-21 02:10:19 +00:00
|
|
|
guint8 mesh_ttl;
|
|
|
|
guint16 mesh_e2eseq;
|
|
|
|
|
2009-05-02 21:51:51 +00:00
|
|
|
/* Make entries in Protocol column and Info column on summary display */
|
2009-08-09 06:26:46 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "Mesh");
|
2011-10-21 02:10:19 +00:00
|
|
|
|
2009-05-02 21:51:51 +00:00
|
|
|
if (tree) {
|
2011-10-21 02:10:19 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_mesh, tvb, 0, 5, ENC_NA);
|
2009-05-02 21:51:51 +00:00
|
|
|
mesh_tree = proto_item_add_subtree(ti, ett_mesh);
|
|
|
|
|
|
|
|
/* add an item to the subtree, see section 1.6 for more information */
|
|
|
|
mesh_ttl = tvb_get_guint8(tvb, 2);
|
|
|
|
proto_tree_add_uint(mesh_tree, hf_mesh_ttl, tvb, 2, 1, mesh_ttl);
|
2011-10-21 02:10:19 +00:00
|
|
|
|
2009-05-02 21:51:51 +00:00
|
|
|
mesh_e2eseq = tvb_get_ntohs(tvb, 3);
|
|
|
|
proto_tree_add_uint(mesh_tree, hf_mesh_e2eseq, tvb, 3, 2, mesh_e2eseq);
|
|
|
|
}
|
2011-10-21 02:10:19 +00:00
|
|
|
|
2009-05-02 21:51:51 +00:00
|
|
|
/* Return the amount of data this dissector was able to dissect */
|
|
|
|
return 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Register the protocol with Wireshark */
|
|
|
|
|
|
|
|
/* this format is require because a script is used to build the C function
|
|
|
|
that calls all the protocol registration.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_mesh(void)
|
2011-10-21 02:10:19 +00:00
|
|
|
{
|
2009-05-02 21:51:51 +00:00
|
|
|
/* Setup list of header fields See Section 1.6.1 for details*/
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_mesh_ttl,
|
|
|
|
{ "Mesh TTL", "mesh.ttl", FT_UINT8, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, 0x0, NULL, HFILL }},
|
2009-05-02 21:51:51 +00:00
|
|
|
|
|
|
|
{ &hf_mesh_e2eseq,
|
|
|
|
{ "Mesh End-to-end Seq", "mesh.e2eseq", FT_UINT16, BASE_HEX,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, 0x0, NULL, HFILL }},
|
2009-05-02 21:51:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Setup protocol subtree array */
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_mesh
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Register the protocol name and description */
|
|
|
|
proto_mesh = proto_register_protocol("Mesh Header", "Mesh", "mesh");
|
|
|
|
|
|
|
|
/* Required function calls to register the header fields and subtrees used */
|
|
|
|
proto_register_field_array(proto_mesh, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
|
2015-12-09 04:04:01 +00:00
|
|
|
register_dissector("mesh", dissect_mesh, proto_mesh);
|
2009-05-02 21:51:51 +00:00
|
|
|
}
|
2014-09-29 18:07:49 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
|
|
*
|
|
|
|
* Local Variables:
|
|
|
|
* c-basic-offset: 2
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* ex: set shiftwidth=2 tabstop=8 expandtab:
|
|
|
|
* :indentSize=2:tabSize=8:noTabs=true:
|
|
|
|
*/
|