Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-eero.c
bloba2dea20b04e7774e41cb9953cb6a470bc578ebab
1 /* packet-eero.c
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
15 #include "config.h"
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;
31 static int ett_eero;
33 static dissector_handle_t eero_handle;
35 static capture_dissector_handle_t eero_cap_handle;
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_)
42 capture_dissector_increment_count(cpinfo, proto_eero);
43 return true;
46 static int
47 dissect_eero(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
49 int tot_len;
50 proto_tree *eero_tree = NULL;
51 proto_item *ti;
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);
59 if (tree)
61 int offset=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);
69 offset+=1;
71 proto_tree_add_item(eero_tree, hf_eero_src_mac, tvb, offset, 6, ENC_NA);
72 offset += 6;
74 proto_tree_add_item(eero_tree,
75 hf_eero_data,
76 tvb, offset, tvb_reported_length_remaining(tvb,offset), ENC_NA);
79 return tvb_captured_length(tvb);
82 void
83 proto_register_eero(void)
85 static hf_register_info hf[] = {
86 { &hf_eero_src_mac,
87 { "Sender MAC address", "eero.hw_mac",
88 FT_ETHER, BASE_NONE, NULL, 0x0,
89 NULL, HFILL }},
90 { &hf_eero_type,
91 { "Type", "eero.type",
92 FT_UINT8, BASE_DEC, NULL, 0x0,
93 NULL, HFILL }
95 { &hf_eero_data,
96 { "Data", "eero.data",
97 FT_BYTES, BASE_NONE, NULL, 0x0,
98 NULL, HFILL }},
101 static int *ett[] = {
102 &ett_eero
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);
116 void
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
127 * Local Variables:
128 * c-basic-offset: 2
129 * tab-width: 8
130 * indent-tabs-mode: nil
131 * End:
133 * ex: set shiftwidth=2 tabstop=8 expandtab:
134 * :indentSize=2:tabSize=8:noTabs=true: