Ethereal-dev: Re: [ethereal-dev] Find parent of current 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, 12 Aug 1999 12:00:15 -0500
On Thu, Aug 12, 1999 at 11:40:29AM -0500, Jeff Foster wrote:
> 
> 
> 
> I have an need to get the parent of the current proto_tree, can anyone tell
> me how to do that ?
> 
> Jeff Foster
> jfoste@xxxxxxxxxxxx
> 

When you say 'parent', do you mean 'the parent protocol of a particular
field', or 'the protocol lower in the stack'?

At the top level of the proto_tree, just as in the GUI tree, the
protocols are not stacked in parent-child relationships, but in sibling
relationships:

top-level proto_tree
    |
    + ------ Frame
    |        |
    |        +---- data
    |        |
    |        +---- data
    |
    |
    + ------ Ethernet
    |        |
    |        +---- data
    |        |
    |        +---- data
    |
    |
    + ------ LLC
    |        |
    |        +---- data
    |        |
    |        +---- data
    .
    .
    .

If you are looking for the parent of one of the sub-branches (in order
to find which protocol it belongs to), then you are looking for
a parent relationship.

If you are looking for the protocol which preceded your protocol,
you are looking for a sibling relationship.

Which are you trying to do? 

--gilbert