Coverage Report

Created: 2026-08-14 06:45

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-eero.c
Line
Count
Source
1
/* packet-eero.c
2
 * Routines for EERO packet disassembly
3
 *
4
 * By Charlie Lenahan <clenahan@sonicbison.com>
5
 * Copyright 2019 Charlie Lenahan
6
 *
7
 * Wireshark - Network traffic analyzer
8
 * By Gerald Combs <gerald@wireshark.org>
9
 * Copyright 1998 Gerald Combs
10
 *
11
 *
12
 * SPDX-License-Identifier: GPL-2.0-or-later
13
 */
14
15
#include "config.h"
16
17
#include <epan/packet.h>
18
#include <epan/capture_dissectors.h>
19
#include <epan/etypes.h>
20
21
22
void proto_register_eero(void);
23
void proto_reg_handoff_eero(void);
24
25
static int proto_eero;
26
27
static int hf_eero_type;
28
static int hf_eero_src_mac;
29
static int hf_eero_data;
30
31
static int ett_eero;
32
33
static dissector_handle_t eero_handle;
34
35
static capture_dissector_handle_t eero_cap_handle;
36
37
38
39
static bool
40
capture_eero(const unsigned char *pd _U_, int offset _U_, int len _U_, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header _U_)
41
0
{
42
0
  capture_dissector_increment_count(cpinfo, proto_eero);
43
0
  return true;
44
0
}
45
46
static int
47
dissect_eero(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
48
2
{
49
2
  int           tot_len;
50
2
  proto_tree   *eero_tree           = NULL;
51
2
  proto_item   *ti;
52
53
2
  col_set_str(pinfo->cinfo, COL_PROTOCOL, "EERO");
54
2
  col_clear(pinfo->cinfo, COL_INFO);
55
56
2
  tot_len = tvb_reported_length_remaining(tvb,0);
57
58
59
2
  if (tree)
60
2
  {
61
2
      int offset=0;
62
2
      int type = tvb_get_uint8(tvb, 0);
63
64
2
      ti = proto_tree_add_protocol_format(tree, proto_eero, tvb, offset, tot_len, "EERO,  Type 0x%04x", type);
65
66
2
      eero_tree = proto_item_add_subtree(ti, ett_eero);
67
68
2
      proto_tree_add_uint(eero_tree, hf_eero_type, tvb, offset, 1, type);
69
2
      offset+=1;
70
71
2
      proto_tree_add_item(eero_tree, hf_eero_src_mac, tvb, offset, 6, ENC_NA);
72
2
      offset += 6;
73
74
2
      proto_tree_add_item(eero_tree,
75
2
                          hf_eero_data,
76
2
                          tvb, offset, tvb_reported_length_remaining(tvb,offset), ENC_NA);
77
2
  }
78
79
2
   return tvb_captured_length(tvb);
80
2
}
81
82
void
83
proto_register_eero(void)
84
16
{
85
16
  static hf_register_info hf[] = {
86
16
      { &hf_eero_src_mac,
87
16
          { "Sender MAC address", "eero.hw_mac",
88
16
              FT_ETHER, BASE_NONE, NULL, 0x0,
89
16
              NULL, HFILL }},
90
16
      { &hf_eero_type,
91
16
          { "Type", "eero.type",
92
16
              FT_UINT8, BASE_DEC, NULL, 0x0,
93
16
              NULL, HFILL }
94
16
      },
95
16
      { &hf_eero_data,
96
16
          { "Data", "eero.data",
97
16
              FT_BYTES, BASE_NONE, NULL, 0x0,
98
16
              NULL, HFILL }},
99
16
  };
100
101
16
  static int *ett[] = {
102
16
    &ett_eero
103
16
  };
104
105
106
16
  proto_eero = proto_register_protocol("EERO Protocol","EERO", "eero");
107
108
16
  proto_register_field_array(proto_eero, hf, array_length(hf));
109
16
  proto_register_subtree_array(ett, array_length(ett));
110
111
16
  eero_handle = register_dissector( "eero" , dissect_eero, proto_eero );
112
113
16
  eero_cap_handle = register_capture_dissector("eero", capture_eero, proto_eero);
114
16
}
115
116
void
117
proto_reg_handoff_eero(void)
118
16
{
119
16
  dissector_add_uint("ethertype", ETHERTYPE_EERO, eero_handle);
120
121
16
  capture_dissector_add_uint("ethertype", ETHERTYPE_EERO, eero_cap_handle);
122
16
}
123
124
/*
125
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
126
 *
127
 * Local Variables:
128
 * c-basic-offset: 2
129
 * tab-width: 8
130
 * indent-tabs-mode: nil
131
 * End:
132
 *
133
 * ex: set shiftwidth=2 tabstop=8 expandtab:
134
 * :indentSize=2:tabSize=8:noTabs=true:
135
 */