diff options
author | Michael Mann <mmann78@netscape.net> | 2013-11-21 19:51:17 +0000 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2013-11-21 19:51:17 +0000 |
commit | 9fa6c9fb800199967b5ec44a93fcfaeeed405085 (patch) | |
tree | 862cb08f36e01a1f34506898ceac858dcab653bf /epan/dissectors/packet-wol.c | |
parent | 82f7344f453783255228971b90a6bdb8243e0eaa (diff) |
Create new dissectors when a protocol goes across ethernet and "something else" instead a single dissector that uses pinfo->ethertype to determine if it's the "ethernet" or the "something else" case.
svn path=/trunk/; revision=53488
Diffstat (limited to 'epan/dissectors/packet-wol.c')
-rw-r--r-- | epan/dissectors/packet-wol.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/epan/dissectors/packet-wol.c b/epan/dissectors/packet-wol.c index 465a2fcea5..8a87c68a9e 100644 --- a/epan/dissectors/packet-wol.c +++ b/epan/dissectors/packet-wol.c @@ -62,26 +62,19 @@ #include <epan/addr_resolv.h> #include <epan/etypes.h> -/* IF PROTO exposes code to other dissectors, then it must be exported - in a header file. If not, a header file is not needed at all. */ -/* #include "packet-wol.h" */ - /* Initialize the protocol and registered fields */ static int proto_wol = -1; static int hf_wol_sync = -1; static int hf_wol_mac = -1; static int hf_wol_passwd = -1; -/* Global sample preference ("controls" display of numbers) */ -/* static gboolean gPREF_HEX = FALSE; */ - /* Initialize the subtree pointers */ static gint ett_wol = -1; static gint ett_wol_macblock = -1; /* Code to actually dissect the packets */ static int -dissect_wol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) +dissect_wol_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { guint len; gint offset; @@ -259,14 +252,22 @@ dissect_wol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) 6, passwd, "%s", passwd); } -/* If this protocol has a sub-dissector call it here, see section 1.8 */ + return (len); +} -/* Return the amount of data this dissector was able to dissect */ - if ( pinfo->ethertype == ETHERTYPE_WOL ) - return (len); +static int +dissect_wol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) +{ + return dissect_wol_pdu(tvb, pinfo, tree, data); +} - /* Heuristic dissectors return TRUE/FALSE. */ - return (TRUE); +static gboolean +dissect_wolheur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) +{ + if (dissect_wol_pdu(tvb, pinfo, tree, data) > 0) + return TRUE; + + return FALSE; } @@ -306,7 +307,6 @@ proto_register_wol(void) proto_register_subtree_array(ett, array_length(ett)); } - /* If this dissector uses sub-dissector registration add a registration routine. This exact format is required because a script is used to find these routines and create the code that calls these routines. @@ -333,7 +333,7 @@ proto_reg_handoff_wol(void) * we'll miss some, but how else to do this ... add a thousand of * these dissector_add_uint()'s and heur_dissector_add()'s??? */ dissector_add_uint("ethertype", ETHERTYPE_WOL, wol_handle); - heur_dissector_add("udp", dissect_wol, proto_wol); + heur_dissector_add("udp", dissect_wolheur, proto_wol); } /* |