Wireshark-dev: Re: [Wireshark-dev] Adding numbers to the tree

Date: Fri, 13 Feb 2009 14:00:10 -0600
Ahh thank you, i think i get that. But also, for "id". It takes an int, but what if i want to put a different string there? I want to be able to include my own string for output that isn't in a static const value_string. I will be return data from a function from a loaded dll. And just something like:

proto_tree_add_uint(tree, "Test: ", tvb, 0, 0, 7) 

or

proto_tree_add_uint(tree, testfunction(), tvb, 0, 0, 7)

where testfunction() would return a char * or something of the sort. Is there an easy way to do something like this?

Greg


-----Original Message-----
From: Jaap Keuter [mailto:jaap.keuter@xxxxxxxxx] 
Sent: Friday, February 13, 2009 2:33 PM
To: gogrady@xxxxxxxxx
Subject: Re: [Wireshark-dev] Adding numbers to the tree

Hi,

Use as tvb the tvb you got when the dissector was called and the start and 
length of the data you feed to the external code. Or just use 0 for both.
These values are only used for marking the relevant bytes in the packet bytes 
pane (usually the lower pane). Note that the tvb is mandatory, it can't be NULL.

Thanx,
Jaap

gogrady@xxxxxxxxx wrote:
> Hi,
> I read both of these. Say i just wanted to output the integer 7. 
> proto_tree_add_uint(tree, id, tvb?, ?, ?, 7);
> i dont understand what tvb is / does i guess.
> 
> Also, i will be using the raw data to send to a function to send back a string for the header names. where would be the best place to put the function for the return string? would in the proto_register hf_register_info be ok? or in the dissect_foo() when adding to the tree? and what data type should be used, i was thinking char * but so far i've only gotten junk to output when using proto_tree_add_text(...) when i have a test function returning "test" as a char *.
> 
> Greg