Add a mechanism by which a dissector can be registered by name, another
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 15 Nov 2000 07:07:52 +0000 (07:07 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 15 Nov 2000 07:07:52 +0000 (07:07 +0000)
commit021246c5e20ba3d33202cca602cc2144a8bf7dd2
treeb2bb48ca0cc103556fb5908f6cc9ea9a9f278581
parent9755a2c4c6e4de341e833627018a3c362f57335a
Add a mechanism by which a dissector can be registered by name, another
dissector can get a "handle" for that dissector by name and then call
that dissector through the handle.

This allows dissectors that can't be called through a port table or a
heuristic table to be called from other dissectors without directly
referring to the dissector function - dynamically-loaded modules, under
Windows, cannot directly call functions in the main program, and
non-plugin dissectors are in the main program and thus cannot be called
from plugin dissectors unless either

1) a pointer to the dissector is put in the Big Transfer Vector

or

2) some other mechanism for getting a pointer to the dissector
   is provided.

This mechanism could also support registering old-style dissectors and
calling them from new-style dissectors without the new-style dissector
having to do the argument translation itself (I didn't add support for
registering old-style dissectors because I'd prefer to have people
tvbuffify their code if they have to register a dissector...).

It could also, in the future, perhaps support

disabling of protocols;

setting "pinfo->current_proto";

inside "call_dissector()" - and inside "{old_}dissector_try_port()" and
"{old_"dissector_try_heuristic()" - allowing a pile of stuff that
currently has to be done in every dissector be done by common code.
(I have some ideas about how to do this, by

having "proto_register_protocol()" take an abbreviation - of the
sort that would be put in, for example, "pinfo->current_proto" -
as an argument;

having the calls to register dissectors take an index returned
by "proto_register_protocol()" as an argument.

The abbreviation could be used elsewhere as well, e.g. in the "Decoding"
tab of the "Edit->Protocols" dialog box, and in a GUI for constructing
protocol filters.  Watch this space.)

Make "dissect_sdp()" the first client of this mechanism; it's now static
to "packet-sdp.c", and all dissectors that call it - including the MGCP
plugin - now call it through a dissector handle fetched by
"find_dissector()".  (Next step - see if Ethereal can now compile on
Windows as a result of this.)

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@2647 f5534014-38df-0310-8fa8-9805f1628bb7
13 files changed:
Makefile.am
epan/packet.c
epan/packet.h
epan/plugins.c
packet-rtsp.c
packet-sap.c
packet-sdp.c
packet-sdp.h [deleted file]
packet-sip.c
plugins/mgcp/packet-mgcp.c
plugins/plugin_api.c
plugins/plugin_api.h
plugins/plugin_table.h