Wireshark-dev: Re: [Wireshark-dev] How to extract guint64 data
From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Thu, 26 Oct 2006 03:24:18 -0700
prashanth joshi wrote:

the function to extract the data are,
tvb_get_uint8,  tvb_get_ntohs and         ( guint32 ) tvb_get_ntohl.
How to extract a 64 bit data. ie guint64 data.

tvb_get_ntoh64() or tvb_get_letoh64().  (I'll update doc/README.developer.)

Also I wanted to know whether adding a local variable to the display tree has got the chances of making dangling reference occur. ( during run time the display tree is built and when run time is just about to end , the display tree will be acted upon by ethereal. So during this time it may refer to a data which was locally defined in a function previously but is no longer in use.)

No. A copy of the value supplied to a proto_tree_add_ routine is made - even if the value points to, for example, a string.

(Note that if the local variable is a string buffer, you'd better make sure the string buffer is big enough to handle the largest possible string in a packet, otherwise you are at risk of a buffer overflow. We suggest you use routines that return an emem-allocated string buffer instead.)