Ethereal-dev: Re: [ethereal-dev] Keeping state and name tables

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

From: "Gilbert Ramirez Jr." <gram@xxxxxxxxxx>
Date: Tue, 5 Oct 1999 09:30:10 -0400
On Mon, Oct 04, 1999 at 08:32:35AM +0900, Richard Sharpe wrote:
> 
> And, for a packet, in any dissect module, I think I need to be able to
> retrieve information from lower layers for use in storing state information
> in the hash table.
> 
> So, in dissect_smb, I want to do something like:
> 
>    src_ip = get_src_ip(packet);
>    dst_ip = get_dst_ip(packet);
>    src_port = get_src_port(packet);
>    dst_port = get_dst_port(packet);

We could have the IP and TCP/UDP layers "export" this info into
a per-packet struct. We'd have to add "exported" variables each time a
protocol needs a new lower-layer variable.

Or, we could have the higher-layer protocols "import" the info by
walking the proto_tree. The higher-layer protocol has the proto_tree. All
it needs is the registration ID of the field it's looking for, like
hf_ip_src and hf_ip_dst.

--gilbert