diff options
author | Guy Harris <guy@alum.mit.edu> | 2000-11-05 09:05:00 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2000-11-05 09:05:00 +0000 |
commit | 1964cfddf69833831f464e997579071208150d57 (patch) | |
tree | e84e70c5f7ffe323b46ebb0b75e87a31d193ef31 /plugins | |
parent | 3f4e41dc383b6dc436e89a43af3d18bf749ef635 (diff) | |
download | wireshark-1964cfddf69833831f464e997579071208150d57.tar.gz wireshark-1964cfddf69833831f464e997579071208150d57.tar.bz2 wireshark-1964cfddf69833831f464e997579071208150d57.zip |
Allow plugins to have, instead of "protocol" and "filter_string"
variables and a "dissector" routine, a "plugin_reg_handoff()" routine,
which will act just like the "reg_handoff()" routine of a non-plugin
dissector, registering the dissector with handoff tables.
This lets them plug into both TCP and UDP, or plug into protocols other
than TCP or UDP.
Those new-style plugin are enabled and disabled using the standard
"Edit->Protocols" mechanism (and thus should use
"OLD_CHECK_DISPLAY_AS_DATA()" or "CHECK_DISPLAY_AS_DATA()"); they don't
show up in the list of plugins, aren't enabled or disabled from that
list, and, as they don't have a filter, can't have the filter changed
from that list - instead, they should register preferences for port
numbers and the like if they should be configurable to use different
ports.
Make the Gryphon protocol a new-style plugin.
svn path=/trunk/; revision=2565
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/gryphon/packet-gryphon.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/plugins/gryphon/packet-gryphon.c b/plugins/gryphon/packet-gryphon.c index a69dca64bc..f957e909d5 100644 --- a/plugins/gryphon/packet-gryphon.c +++ b/plugins/gryphon/packet-gryphon.c @@ -1,7 +1,7 @@ /* packet-gryphon.c * Routines for Gryphon protocol packet disassembly * - * $Id: packet-gryphon.c,v 1.12 2000/11/01 00:16:17 guy Exp $ + * $Id: packet-gryphon.c,v 1.13 2000/11/05 09:05:00 guy Exp $ * * Ethereal - Network traffic analyzer * By Steve Limkemann <stevelim@dgtech.com> @@ -51,8 +51,6 @@ DLLEXPORT const gchar version[] = VERSION; DLLEXPORT const gchar desc[] = "DG Gryphon Protocol"; -DLLEXPORT const gchar protocol[] = "tcp"; -DLLEXPORT const gchar filter_string[] = "tcp.port == 7000"; #ifndef G_HAVE_GINT64 #error "Sorry, this won't compile without 64-bit integer support" @@ -87,8 +85,8 @@ static gint ett_gryphon_pgm_options = -1; -DLLEXPORT void -dissector(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) +static void +dissect_gryphon(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { proto_tree *gryphon_tree, *header_tree, *body_tree, *localTree; @@ -116,6 +114,8 @@ dissector(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {-1, "- unknown -"}, }; + OLD_CHECK_DISPLAY_AS_DATA(proto_gryphon, pd, offset, fd, tree); + data = &pd[offset]; if (fd) { end_of_frame = END_OF_FRAME; @@ -1228,7 +1228,7 @@ cmd_addresp (int src, const u_char **data, const u_char *dataend, int *offset, i length += 3 - (length + 3) % 4; item = proto_tree_add_text(pt, NullTVB, *offset, length, "Response block %d", i); tree = proto_item_add_subtree (item, ett_gryphon_cmd_response_block); - dissector((*data)-*offset, *offset, NULL, tree); + dissect_gryphon((*data)-*offset, *offset, NULL, tree); BUMP (*offset, *data, length); } } @@ -1702,7 +1702,6 @@ plugin_init(plugin_address_table_t *pat) &ett_gryphon_pgm_options, }; plugin_address_table_init(pat); - dfilter_cleanup(); if (proto_gryphon == -1) { /* first activation */ proto_gryphon = proto_register_protocol("DG Gryphon Protocol", @@ -1713,5 +1712,10 @@ plugin_init(plugin_address_table_t *pat) /* do nothing, this is in fact a re-activation with possibly a new filter */ } - dfilter_init(); +} + +void +plugin_reg_handoff(void) +{ + old_dissector_add("tcp.port", 7000, &dissect_gryphon); } |