On Sun, 16 Nov 2003, Guy Harris wrote:
> On Sat, Nov 15, 2003 at 10:45:20PM -0800, Richard Sharpe wrote:
> > We seem to be doing some silly things ... while it is useful to keep the
> > protocols in a glist, because we need to iterate over them, I don't see
> > why we are doing this:
> >
> > if (handle->proto_index != -1 &&
> > !proto_is_protocol_enabled(handle->proto_index)) {
> > /*
> > * The protocol isn't enabled.
> > */
> > return 0;
> > }
> >
> > proto_index should be a void * that actually points to an instance of a
> > protocol_t. That way we can, in the epan/proto.c routines, simply
> > dereference it to get at the fields we need.
>
> No, we should replace "proto_index" with a "protocol_t *", and give it a
> name that doesn't contain "index" (as it's a pointer, not an index).
OK, I guess that was what I was trying to say in my clumsy way.
> A null "protocol_t" pointer would be equivalent to -1 as "proto_index".
> A "protocol_t" contains a protocol index, so
> "dissector_handle_get_protocol_index()" could still work.
>
> A dissector_handle_t is opaque outside "epan/packet.c", so we don't have
> to worry about dragging in extra include files if we add a "protocol_t
> *" to the dissector handle. It does, however, require that we export
> "protocol_t" from "epan/proto.c" to "epan/packet.c".
Yes, then the big problem is that we need to run an AWK script across all
the source changing all those protocol index def'ns.
Regards
-----
Richard Sharpe, rsharpe[at]ns.aus.com, rsharpe[at]samba.org,
sharpe[at]ethereal.com, http://www.richardsharpe.com