diff options
author | Jörg Mayer <jmayer@loplof.de> | 2006-06-04 13:07:13 +0000 |
---|---|---|
committer | Jörg Mayer <jmayer@loplof.de> | 2006-06-04 13:07:13 +0000 |
commit | 98477bc4e4e20ff23c5d195e87b121722daa0252 (patch) | |
tree | 395a6fd64ce8b6db00d6959fbb74b76912c0cd0a | |
parent | 5f6f853d16d8b2b14bc944a8376bb2f5b2e7c490 (diff) | |
download | wireshark-98477bc4e4e20ff23c5d195e87b121722daa0252.tar.gz |
Add some rudimentary dissector for what seems to be
Telkonets ethernet over powerline communication protocol.
svn path=/trunk/; revision=18333
-rw-r--r-- | epan/dissectors/Makefile.common | 1 | ||||
-rw-r--r-- | epan/dissectors/packet-ethertype.c | 1 | ||||
-rw-r--r-- | epan/dissectors/packet-telkonet.c | 116 | ||||
-rw-r--r-- | epan/etypes.h | 4 |
4 files changed, 122 insertions, 0 deletions
diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common index b9ed644f2c..29cf64efb8 100644 --- a/epan/dissectors/Makefile.common +++ b/epan/dissectors/Makefile.common @@ -617,6 +617,7 @@ DISSECTOR_SRC = \ packet-telnet.c \ packet-teredo.c \ packet-text-media.c \ + packet-telkonet.c \ packet-tftp.c \ packet-time.c \ packet-tipc.c \ diff --git a/epan/dissectors/packet-ethertype.c b/epan/dissectors/packet-ethertype.c index edaf952693..b3e04a7674 100644 --- a/epan/dissectors/packet-ethertype.c +++ b/epan/dissectors/packet-ethertype.c @@ -95,6 +95,7 @@ const value_string etype_vals[] = { {ETHERTYPE_CDMA2000_A10_UBS, "CDMA2000 A10 Unstructured byte stream" }, {ETHERTYPE_PROFINET, "PROFINET" }, {ETHERTYPE_AOE, "ATA over Ethernet" }, + {ETHERTYPE_TELKONET, "Telkonet powerline" }, {ETHERTYPE_CSM_ENCAPS, "CSM_ENCAPS Protocol" }, {ETHERTYPE_IEEE802_OUI_EXTENDED, "IEEE 802a OUI Extended Ethertype" }, {ETHERTYPE_IEC61850_GOOSE, "IEC 61850/GOOSE" }, diff --git a/epan/dissectors/packet-telkonet.c b/epan/dissectors/packet-telkonet.c new file mode 100644 index 0000000000..309c29e7ee --- /dev/null +++ b/epan/dissectors/packet-telkonet.c @@ -0,0 +1,116 @@ +/* packet-telkonet.c + * Routines for ethertype 0x88A1 tunneling dissection + * + * $Id: packet-telkonet.c 18196 2006-05-21 04:49:01Z sahlberg $ + * + * Copyright 2006 Joerg Mayer (see AUTHORS file) + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* 2do: + * - find out more about the real meaning of the 8 bytes + * and possible other packet types + * - Telkonet (www.telkonet.com) has registered other ethertypes + * as well: find out what they do + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include <glib.h> +#include <epan/packet.h> +#include <epan/etypes.h> + +static int proto_telkonet = -1; +static int hf_telkonet_type = -1; + +static gint ett_telkonet = -1; + +static dissector_handle_t eth_withoutfcs_handle; + +typedef enum { + TELKONET_TYPE_TUNNEL = 0x78 +} telkonet_type_t; + +static const value_string telkonet_type_vals[] = { + { TELKONET_TYPE_TUNNEL, "tunnel" }, + + { 0x00, NULL } +}; + +static void +dissect_telkonet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + proto_tree *ti, *telkonet_tree; + int offset = 0; + telkonet_type_t type; + + if (check_col(pinfo->cinfo, COL_PROTOCOL)) + col_set_str(pinfo->cinfo, COL_PROTOCOL, "TELKONET"); + if (check_col(pinfo->cinfo, COL_INFO)) + col_clear(pinfo->cinfo, COL_INFO); + + type = tvb_get_guint8(tvb, offset); + if (check_col(pinfo->cinfo, COL_INFO)) { + col_add_fstr(pinfo->cinfo, COL_INFO, "Telkonet type: %s", + val_to_str(type, telkonet_type_vals, "Unknown (0x%02x)")); + } + + telkonet_tree = NULL; + + ti = proto_tree_add_item(tree, proto_telkonet, tvb, 0, 8, FALSE); + telkonet_tree = proto_item_add_subtree(ti, ett_telkonet); + + proto_tree_add_item(telkonet_tree, hf_telkonet_type, tvb, 0, 8, FALSE); + offset += 8; + + if (type == TELKONET_TYPE_TUNNEL) + call_dissector(eth_withoutfcs_handle, tvb_new_subset(tvb, offset, -1, -1), + pinfo, tree); +} + +void +proto_register_telkonet(void) +{ + static hf_register_info hf[] = { + { &hf_telkonet_type, + { "Type", "telkonet.type", FT_BYTES, BASE_NONE, NULL, + 0x0, "TELKONET type", HFILL }}, + }; + static gint *ett[] = { + &ett_telkonet, + }; + + proto_telkonet = proto_register_protocol("Telkonet powerline", "TELKONET", "telkonet"); + proto_register_field_array(proto_telkonet, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); +} + +void +proto_reg_handoff_telkonet(void) +{ + dissector_handle_t telkonet_handle; + + eth_withoutfcs_handle = find_dissector("eth_withoutfcs"); + + telkonet_handle = create_dissector_handle(dissect_telkonet, proto_telkonet); + dissector_add("ethertype", ETHERTYPE_TELKONET, telkonet_handle); +} diff --git a/epan/etypes.h b/epan/etypes.h index 6040f88aa2..6029739bb2 100644 --- a/epan/etypes.h +++ b/epan/etypes.h @@ -252,6 +252,10 @@ #define ETHERTYPE_CSM_ENCAPS 0x889B /* Mindspeed Technologies www.mindspeed.com */ #endif +#ifndef ETHERTYPE_TELKONET +#define ETHERTYPE_TELKONET 0x88A1 /* Telkonet powerline ethernet */ +#endif + #ifndef ETHERTYPE_AOE #define ETHERTYPE_AOE 0x88A2 #endif |