On Thu, Jul 18, 2002 at 10:11:17AM +0200, Miha Jemec wrote:
> The routine now loops between nodes: Frame->Ethernet->Internet Protocol->and 
> upper layer protocols. How can I get the items or list of one node, let's say 
> rtp?

The "process_node()" in "proto_hier_stats.c" only scans the top-level
nodes.

It's also recursive, which I don't think it needs to be.

What you might want to do would be to get the ID value for the "rtp"
protocol:

        hfinfo = proto_registrar_get_byname("rtp");
        if (hfinfo == NULL)
                give up, somehow "rtp" didn't get registered;
        proto_rtp = hfinfo->id;

and the hfinfo value for "rtp.ssrc":

        hfinfo_ssrc = proto_registrar_get_byname("rtp.ssrc");
        if (hfinfo_ssrc == NULL)
                give up, somehow "rtp.ssrc" didn't get registered;

and then have your equivalent to "process_tree()" just have a loop
something like:

        for (ptree_node = g_node_first_child(protocol_tree);
            ptree_node != NULL;
            ptree_node = g_node_next_sibling(ptree_node)) {
                /*
                 * Is this a subtree for RTP?
                 */
                finfo = PITEM_FINFO(ptree_node);
                if (finfo->hfinfo->parent == proto_rtp) {
                        /*
                         * Yes.
                         * Now scan all the nodes in it until you
                         * find an "ssrc" node, and return its value.
                         */
                        finfo = find_node(ptree_node, hfinfo_ssrc);
                        if (finfo != NULL) {
                                /*
                                 * We found it.
                                 */
                                get the value from "finfo";
                        }
                }
        }

with "find_node()" being something that recursively walks the tree
specified by its first argument looking for a node whose "finfo->hfinfo"
equals its second argument.

Reply via email to