2 * Routines for EERO packet disassembly
4 * By Charlie Lenahan <clenahan@sonicbison.com>
5 * Copyright 2019 Charlie Lenahan
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
12 * SPDX-License-Identifier: GPL-2.0-or-later
17 #include <epan/packet.h>
18 #include <epan/capture_dissectors.h>
19 #include <epan/etypes.h>
22 void proto_register_eero(void);
23 void proto_reg_handoff_eero(void);
25 static int proto_eero
;
27 static int hf_eero_type
;
28 static int hf_eero_src_mac
;
29 static int hf_eero_data
;
33 static dissector_handle_t eero_handle
;
35 static capture_dissector_handle_t eero_cap_handle
;
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_
)
42 capture_dissector_increment_count(cpinfo
, proto_eero
);
47 dissect_eero(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
50 proto_tree
*eero_tree
= NULL
;
53 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "EERO");
54 col_clear(pinfo
->cinfo
, COL_INFO
);
56 tot_len
= tvb_reported_length_remaining(tvb
,0);
62 int type
= tvb_get_uint8(tvb
, 0);
64 ti
= proto_tree_add_protocol_format(tree
, proto_eero
, tvb
, offset
, tot_len
, "EERO, Type 0x%04x", type
);
66 eero_tree
= proto_item_add_subtree(ti
, ett_eero
);
68 proto_tree_add_uint(eero_tree
, hf_eero_type
, tvb
, offset
, 1, type
);
71 proto_tree_add_item(eero_tree
, hf_eero_src_mac
, tvb
, offset
, 6, ENC_NA
);
74 proto_tree_add_item(eero_tree
,
76 tvb
, offset
, tvb_reported_length_remaining(tvb
,offset
), ENC_NA
);
79 return tvb_captured_length(tvb
);
83 proto_register_eero(void)
85 static hf_register_info hf
[] = {
87 { "Sender MAC address", "eero.hw_mac",
88 FT_ETHER
, BASE_NONE
, NULL
, 0x0,
91 { "Type", "eero.type",
92 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
96 { "Data", "eero.data",
97 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
101 static int *ett
[] = {
106 proto_eero
= proto_register_protocol("EERO Protocol","EERO", "eero");
108 proto_register_field_array(proto_eero
, hf
, array_length(hf
));
109 proto_register_subtree_array(ett
, array_length(ett
));
111 eero_handle
= register_dissector( "eero" , dissect_eero
, proto_eero
);
113 eero_cap_handle
= register_capture_dissector("eero", capture_eero
, proto_eero
);
117 proto_reg_handoff_eero(void)
119 dissector_add_uint("ethertype", ETHERTYPE_EERO
, eero_handle
);
121 capture_dissector_add_uint("ethertype", ETHERTYPE_EERO
, eero_cap_handle
);
125 * Editor modelines - https://www.wireshark.org/tools/modelines.html
130 * indent-tabs-mode: nil
133 * ex: set shiftwidth=2 tabstop=8 expandtab:
134 * :indentSize=2:tabSize=8:noTabs=true: