Ethereal

Re: [Ethereal-dev] Re: problem in protocol item tree header field display
Google
 
Web Ethereal.com

Home | Introduction | Documentation | Lists | FAQ | Development | Wiki | Bugs

Ethereal-dev: May 2006


Ulf,

Thanks for clearing up the two distinct data structures. I am giving the code snippet below for  dissect_nstrace(). At a highlevel some of you guys can tell if I am doing anything wrong?

I have a trace format where there is header and the ethernet packet. I am passing the ethernet packet to the dissector and the header through the pseudo_header. I want the data in pseudo header to showup as a seperate protocol but not highlight any data in the tvbuff hex representation. So, the start and offsets for all the proto_tree_add_uints() is 0, 0. The summary display is fine.

The proto_tree_add_uints(..) shows the value as zero always. It is able to show the name associated with the hf_xxxx definitions correctly though.

Is it legal to pass 0 for length in the proto_tree_add_xxxx() functions?

thanks,
Ravi.

--- code snippet starts ----
static void
dissect_nstrace(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
  proto_tree   *ns_tree = NULL;
  proto_item   *ti = NULL;
  struct nstr_phdr *pnstr = &(pinfo->pseudo_header->nstr);

  if (tree) {
    ti = proto_tree_add_protocol_format(tree, proto_nstrace, tvb, 0, 0, "NS");
    ns_tree = proto_item_add_subtree(ti, ett_ns);

    proto_tree_add_uint(ns_tree, hf_ns_nicno, tvb, 0, 0, pnstr->nicno);
    proto_tree_add_uint(ns_tree, hf_ns_dir, tvb, 0, 0, pnstr->dir);

    if (pnstr->rec_type == NS_VERSION201)
    {
      proto_tree_add_uint(ns_tree, hf_ns_dev, tvb, 0, 0, pnstr->dev);
      proto_tree_add_uint(ns_tree, hf_ns_l_dev, tvb, 0, 0, pnstr->l_dev);
    }

    /* Dissect as Ethernet */
    call_dissector(eth_withoutfcs_handle, tvb, pinfo, tree);
  }
}
--- code snippet ends ---



Powered by MHonArc 2.6.10