diff options
author | Bill Meier <wmeier@newsguy.com> | 2009-07-07 14:26:38 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2009-07-07 14:26:38 +0000 |
commit | eac1f47fad6986b31dc8b6a4eede197660ca42cf (patch) | |
tree | 102b295df1ce9e8cab475848d55749597905bb86 /plugins/ethercat | |
parent | 3c9c5b9c4a28a1d8b9a5abd76d183ed3f67f9c04 (diff) |
Various fixes:
1. For some reason: using an using the external tfs_yes_no doesn't work in a plugin;
2. proto_reg_handoff: remove unneeded code;
3. Change the prefs callback to call a function which just enables/disables
the protocol; (using proto_reg_handoff means that the dissector
was re-registered each time the pref was changed);
4. packet-esl.h: use #if 0 instead of /* ... */ to comment out code;
svn path=/trunk/; revision=28986
Diffstat (limited to 'plugins/ethercat')
-rw-r--r-- | plugins/ethercat/packet-esl.c | 18 | ||||
-rw-r--r-- | plugins/ethercat/packet-esl.h | 7 |
2 files changed, 14 insertions, 11 deletions
diff --git a/plugins/ethercat/packet-esl.c b/plugins/ethercat/packet-esl.c index 063f9ccae5..3de4b84837 100644 --- a/plugins/ethercat/packet-esl.c +++ b/plugins/ethercat/packet-esl.c @@ -34,7 +34,6 @@ #include <epan/packet.h> #include <epan/prefs.h> -#include <epan/tfs.h> #include "packet-esl.h" @@ -225,6 +224,12 @@ dissect_esl_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) return result; } +static void esl_enable_dissector_cb(void) { + proto_set_decoding(proto_esl, esl_enable_dissector); +} + +static const true_false_string tfs_esl_yes_no = { "Yes", "No" }; + void proto_register_esl(void) { static hf_register_info hf[] = { @@ -235,12 +240,12 @@ proto_register_esl(void) { }, { &hf_esl_crcerror, { "Crc Error", "esl.crcerror", - FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x1000, + FT_BOOLEAN, 16, TFS(&tfs_esl_yes_no), 0x1000, NULL, HFILL } }, { &hf_esl_alignerror, { "Alignment Error", "esl.alignerror", - FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0800, + FT_BOOLEAN, 16, TFS(&tfs_esl_yes_no), 0x0800, NULL, HFILL } }, { &hf_esl_timestamp, @@ -258,7 +263,7 @@ proto_register_esl(void) { proto_esl = proto_register_protocol("EtherCAT Switch Link", "ESL","esl"); - esl_module = prefs_register_protocol(proto_esl, proto_reg_handoff_esl); + esl_module = prefs_register_protocol(proto_esl, esl_enable_dissector_cb); prefs_register_bool_preference(esl_module, "enable", "Enable dissector", "Enable this dissector (default is false)", @@ -273,11 +278,8 @@ proto_register_esl(void) { void proto_reg_handoff_esl(void) { - static dissector_handle_t esl_handle; - - esl_handle = create_dissector_handle(dissect_esl_header, proto_esl); + eth_withoutfcs_handle = find_dissector("eth_withoutfcs"); heur_dissector_add("eth", dissect_esl_heur, proto_esl); - proto_set_decoding(proto_esl, esl_enable_dissector); } diff --git a/plugins/ethercat/packet-esl.h b/plugins/ethercat/packet-esl.h index 858312debb..742a35d9bc 100644 --- a/plugins/ethercat/packet-esl.h +++ b/plugins/ethercat/packet-esl.h @@ -54,13 +54,14 @@ typedef union _EslFlagsUnion guint flags; }EslFlagsUnion; -/* +#if 0 typedef struct _EslHeader { - guint8 eslCookie[6]; // 01 01 05 10 00 00 +guint8 eslCookie[6]; /* 01 01 05 10 00 00 */ EslFlagsUnion flags; guint64 timeStamp; -} EslHeader, *PEslHeader;*/ +} EslHeader, *PEslHeader; +#endif #define SIZEOF_ESLHEADER 16 |