Coverage Report

Created: 2025-08-04 07:15

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