Ethereal-users: Re: [Ethereal-users] protocol tree

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

From: Gilbert Ramirez <gram@xxxxxxxxxx>
Date: Thu, 22 Feb 2001 15:49:10 -0500
On Thu, Feb 22, 2001 at 08:33:22PM +0530, amit shanbhag wrote:
> amit shanbhag wrote:
> Hi
> 
>   ill go step wise...
> 1.) I have registered a protcol using index ett_A
> 2.) I use it to create an item
>          item=proto_tree_add_item(tree,proto_A,NullTVB,offset,END_OF_FRAME,FALSE);
> 3.) I then register a subtree in the main tree;
>     A_tree=proto_item_add_subtree(item,ett_A);
> 
>                 later  on in another C file i do the following
> 
> /*************************************************************************************
>                     *
> 
> ************************************************************************************/
>                 4.)    ti = proto_tree_add_item(A_tree,NullTVB,offset,0,"B Data"   );
>                 5.)   B_tree = proto_item_add_subtree(ti, ett_B;
> 
> in the main C file i have acccess only to ett_B
> now i want to add some items to the B_treein the main file, But i only have ett_B
> with me, How do i get B_tree provided that i have with me A_tree and ett_B
> 
> tree
> |
> --A_tree with index ett_a
>       |
>        --B_tree  with index  ett_b
> 

Are you sure you have your modules defined correctly. Why is the A module
adding information to the B tree? Shouldn't all information about the B tree
be handled in the B module?

There is no way to retrieve a particular branch from the proto_tree
based on the ett_* value.

I guess you could take advantage of the fact that protocol dissection
is single threaded and set a global variable in your B module. Once processing
goes back to the A module, it could use that global variable to retrieve
the B_tree value.  But do you really want to do that at the expense of
a non-clean design?

--gilbert