Ethereal-dev: [Ethereal-dev] Re: Add element to a tree but no from tvb

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

From: ronnie sahlberg <ronniesahlberg@xxxxxxxxx>
Date: Thu, 8 Dec 2005 23:26:36 +0000
Hi,

Dont use proto_tree_add_item()
Use proto_tree_add_<type>() and specify offset and length to 0 to
indicate that no part of the hexpane represents this item.


like
proto_item *item;
item=proto_tree_add_uint(tree, hfindex, tvb, 0, 0, INT_Value);
PROTO_ITEM_SET_GENERATED(item);


The PROTO_ITEM_SET_GENERATED() is to mark the field in the decode pane
as a generated field, i.e. not a filed from the actual packet.


See packet-smb2.c  for several example of proto_tree_add_uint and
PROTO_ITEM_SET_GENERATED



On 12/8/05, David Martínez <abra_kadabra@xxxxxxxxxxx> wrote:
>
> Hi, i'm  newie in development, i am making a dissector and i want to add
> some elements from some vars....For example: my protocol is an oriented bit
> protocol and some camps are 3bits, i get the byte from the tvb and i masked
> for have the value that i want it, but if i want to add this element from
> that var to a tree...i don't know how to do it becouse the functions
> proto_tree_add_XXX only add elements from the tvb, or not??? Please, anyone
> can help me??
>
> David MF
>
>
>
> ________________________________
> Tu horóscopo diario, semanal y gratuito.  Cartas, tarot y predicciones en
> MSN Horóscopo