Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-telkonet.c
blob5bf5ff9fa4876a49ba3751d0e3582b9778c879df
1 /* packet-telkonet.c
2 * Routines for ethertype 0x88A1 tunneling dissection
4 * Copyright 2006 Joerg Mayer (see AUTHORS file)
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 /* 2do:
14 * - find out more about the real meaning of the 8 bytes
15 * and possible other packet types
16 * - Telkonet (www.telkonet.com) has registered other ethertypes
17 * as well: find out what they do
20 #include "config.h"
22 #include <epan/packet.h>
23 #include <epan/etypes.h>
25 void proto_reg_handoff_telkonet(void);
26 void proto_register_telkonet(void);
28 static int proto_telkonet;
29 static int hf_telkonet_type;
31 static int ett_telkonet;
33 static dissector_handle_t telkonet_handle;
34 static dissector_handle_t eth_withoutfcs_handle;
36 typedef enum {
37 TELKONET_TYPE_TUNNEL = 0x78
38 } telkonet_type_t;
40 static const value_string telkonet_type_vals[] = {
41 { TELKONET_TYPE_TUNNEL, "tunnel" },
43 { 0x00, NULL }
46 static int
47 dissect_telkonet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
49 proto_tree *ti, *telkonet_tree;
50 int offset = 0;
51 telkonet_type_t type;
53 col_set_str(pinfo->cinfo, COL_PROTOCOL, "TELKONET");
54 col_clear(pinfo->cinfo, COL_INFO);
56 type = (telkonet_type_t)tvb_get_uint8(tvb, offset);
57 col_add_fstr(pinfo->cinfo, COL_INFO, "Telkonet type: %s",
58 val_to_str(type, telkonet_type_vals, "Unknown (0x%02x)"));
60 ti = proto_tree_add_item(tree, proto_telkonet, tvb, 0, 8, ENC_NA);
61 telkonet_tree = proto_item_add_subtree(ti, ett_telkonet);
63 proto_tree_add_item(telkonet_tree, hf_telkonet_type, tvb, 0, 8, ENC_NA);
64 offset += 8;
66 if (type == TELKONET_TYPE_TUNNEL)
67 call_dissector(eth_withoutfcs_handle, tvb_new_subset_remaining(tvb, offset),
68 pinfo, tree);
70 return tvb_captured_length(tvb);
73 void
74 proto_register_telkonet(void)
76 static hf_register_info hf[] = {
77 { &hf_telkonet_type,
78 { "Type", "telkonet.type", FT_BYTES, BASE_NONE, NULL,
79 0x0, "TELKONET type", HFILL }},
81 static int *ett[] = {
82 &ett_telkonet,
85 proto_telkonet = proto_register_protocol("Telkonet powerline", "TELKONET", "telkonet");
86 proto_register_field_array(proto_telkonet, hf, array_length(hf));
87 proto_register_subtree_array(ett, array_length(ett));
88 telkonet_handle = register_dissector("telkonet", dissect_telkonet, proto_telkonet);
91 void
92 proto_reg_handoff_telkonet(void)
94 eth_withoutfcs_handle = find_dissector_add_dependency("eth_withoutfcs", proto_telkonet);
96 dissector_add_uint("ethertype", ETHERTYPE_TELKONET, telkonet_handle);
100 * Editor modelines - https://www.wireshark.org/tools/modelines.html
102 * Local variables:
103 * c-basic-offset: 8
104 * tab-width: 8
105 * indent-tabs-mode: t
106 * End:
108 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
109 * :indentSize=8:tabSize=8:noTabs=false: