Ethereal-dev: Re: [Ethereal-dev] What is the best way to get data from one dissector to anothe
On Nov 14, 2003, at 10:51 AM, Michael Lum wrote:
The concrete example is OPC/DPC in MTP3:
The OPC and DPC are integers that I want to make available to the SCCP
dissector.
There are a couple of ways to solve that particular problem.
If the OPC and DPC could be thought of as network-layer addresses - for
example, if you'd use them with the Ethereal conversation mechanism,
and you'd be willing to have them show up in the "Source" and
"Destination" columns in the summary display - the right way to do that
would be to:
add AT_MTP3 to the "address_type" enum in "epan/packet_info.h" - or
add 3 AT_ types, for ANSI, ITU and the Chinese ITU variant MTP3;
set "pinfo->src" and "pinfo->net_src" to the source address (OPC?),
using SET_ADDRESS (set it to point to the data in the tvbuff with the
address);
do the same for "pinfo->dst" and "pinfo->net_dst";
add to "address_to_str_buf()" in "epan/to_str.c()" code to construct a
display string from the OPC or DPC;
have the SCCP dissector get the addresses from "pinfo->net_src" and
"pinfo->net_dst".
Otherwise, if they're not network-layer addresses:
put into "packet-mtp3.h" a definition of a structure containing the
two values you want to supply;
have one of those structures in the MTP3 dissector, and fill it in;
set "pinfo->private_data" to point to that structure before calling
the subdissector;
have the SCCP dissector fetch those values from "pinfo->private_data".