Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Ethereal-dev: [Ethereal-dev] protocol handoff still confusing / README.developer out of date

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Ulf Lamping <ulf.lamping@xxxxxx>
Date: Fri, 30 Apr 2004 09:55:39 +0200
Hi List!

I've looked at the README.developer file to understand, how to call a subdissector from another one.

Some of the documentation on this topic seems to be out of date, "1.8 Calling Other Dissector" gives an example from packet-ipx.c,
but that does no longer reflect the current implementation in this file.

As it also is hard to understand how things have to be done, I would like to correct/update/enhance the docs on this topic.


Could someone correct me on the following understanding:

In the upper layer dissector, the proto_reg_handoff_xy() function has to register the upper dissector at the lower one. This is done by first create a dissector_handle_t using create_dissector_handle() and then do a dissector_add() to a specific lower layer protocol field (typically an identifier of the upper layer protocol). Except from the README.developer skeleton code:

void
proto_reg_handoff_PROTOABBREV(void)
{
   dissector_handle_t PROTOABBREV_handle;

   PROTOABBREV_handle = create_dissector_handle(dissect_PROTOABBREV,
       proto_PROTOABBREV);
   dissector_add("PARENT_SUBFIELD", ID_VALUE, PROTOABBREV_handle);
}


In the lower layer code, the dissector will create a new tvb using tvb_new_subset(), and then call the upper layer dissector using call_dissector()


The only thing still missing in my understanding is the data_handle in the call to call_dissector(). At various places I've found:

data_handle = find_dissector("data");

but what's the use of this "data"?

Regards, ULFL