Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-mesh.c
blobe6def1d2018278b9c07fb57085fd89605e48eb93
1 /* packet-mesh-header.c
2 * Routines for Mesh Header dissection
3 * Javier Cardona <javier@cozybit.com>
4 * Copyright 2007, Marvell Semiconductors Inc.
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
13 #include "config.h"
15 #include <epan/packet.h>
17 void proto_register_mesh(void);
19 /* Initialize the protocol and registered fields */
20 static int proto_mesh;
21 static int hf_mesh_ttl;
22 static int hf_mesh_e2eseq;
24 /* Initialize the subtree pointers */
25 static int ett_mesh;
27 /* Code to actually dissect the packets */
28 static int
29 dissect_mesh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
31 /* Set up structures needed to add the protocol subtree and manage it */
32 proto_item *ti;
33 proto_tree *mesh_tree;
34 uint8_t mesh_ttl;
35 uint16_t mesh_e2eseq;
37 /* Make entries in Protocol column and Info column on summary display */
38 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Mesh");
40 if (tree) {
41 ti = proto_tree_add_item(tree, proto_mesh, tvb, 0, 5, ENC_NA);
42 mesh_tree = proto_item_add_subtree(ti, ett_mesh);
44 /* add an item to the subtree, see section 1.6 for more information */
45 mesh_ttl = tvb_get_uint8(tvb, 2);
46 proto_tree_add_uint(mesh_tree, hf_mesh_ttl, tvb, 2, 1, mesh_ttl);
48 mesh_e2eseq = tvb_get_ntohs(tvb, 3);
49 proto_tree_add_uint(mesh_tree, hf_mesh_e2eseq, tvb, 3, 2, mesh_e2eseq);
52 /* Return the amount of data this dissector was able to dissect */
53 return 5;
57 /* Register the protocol with Wireshark */
59 /* this format is require because a script is used to build the C function
60 that calls all the protocol registration.
63 void
64 proto_register_mesh(void)
66 /* Setup list of header fields See Section 1.6.1 for details*/
67 static hf_register_info hf[] = {
68 { &hf_mesh_ttl,
69 { "Mesh TTL", "mesh.ttl", FT_UINT8, BASE_DEC,
70 NULL, 0x0, NULL, HFILL }},
72 { &hf_mesh_e2eseq,
73 { "Mesh End-to-end Seq", "mesh.e2eseq", FT_UINT16, BASE_HEX,
74 NULL, 0x0, NULL, HFILL }},
77 /* Setup protocol subtree array */
78 static int *ett[] = {
79 &ett_mesh
82 /* Register the protocol name and description */
83 proto_mesh = proto_register_protocol("Mesh Header", "Mesh", "mesh");
85 /* Required function calls to register the header fields and subtrees used */
86 proto_register_field_array(proto_mesh, hf, array_length(hf));
87 proto_register_subtree_array(ett, array_length(ett));
89 register_dissector("mesh", dissect_mesh, proto_mesh);
93 * Editor modelines - https://www.wireshark.org/tools/modelines.html
95 * Local Variables:
96 * c-basic-offset: 2
97 * tab-width: 8
98 * indent-tabs-mode: nil
99 * End:
101 * ex: set shiftwidth=2 tabstop=8 expandtab:
102 * :indentSize=2:tabSize=8:noTabs=true: