Ethereal-dev: Re: [Ethereal-dev] can one plugin call another?

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

From: Tomas Kukosa <tomas.kukosa@xxxxxxxxxxx>
Date: Wed, 10 Mar 2004 06:49:46 +0100
In looking at the code there were two problems. The first dissector uses the proto_registrar_get_name() function.

The proto_registrar_get_name() can be added to plugin API
(maybe, with all proto_registrar_*() functions).

My second problem is that the second dissector calls the first. This is because the first protocol is sometime encapsulated in the second. How can this work if both are plugins? I did not see this covered in the readmes.

You can use all standard dissector calling mechanisms.
E.g.:
static void dissect_nu_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
  ...
  if (next_tvb) {
    if (q931_handle)
      call_dissector(q931_handle, next_tvb, pinfo, tree);
    else
      call_dissector(data_handle, next_tvb, pinfo, tree);
  }
}

void proto_reg_handoff_nu(void) {
  ...
  /* Find subdissectors */
  q931_handle = find_dissector("q931");
  data_handle = find_dissector("data");

}