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

From: Bill Meier <wmeier@xxxxxxxxxxx>
Date: Mon, 16 Feb 2009 11:59:20 -0500
gogrady@xxxxxxxxx wrote:
Hi,

when i tried to use your code:

pi = proto_tree_add_text(tree, "Test: %s", tvb, 0, 0, _FunctionFunc());

_FunctionFunc() returns a char *
PROTO_ITEM_SET_GENERATED(pi);

I got these errors:

packet-foo.c
packet-foo.c(167) : error C2220: warning treated as error - no 'object' file generated
packet-foo.c(167) : warning C4133: 'function' : incompatible types - from 'char [9]' to 'tvbuff_t *'
packet-foo.c(167) : warning C4047: 'function' : 'gint' differs in levels of indirection from 'tvbuff_t *'
packet-foo.c(167) : warning C4024: 'proto_tree_add_text' : different types for formal and actual parameter 3
plugin.c
Generating Code...
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.




[Steve got the order of the function parameters mixed up  :)]

The prototype is as follows:

proto_item *
proto_tree_add_text(proto_tree *tree, tvbuff_t *tvb,
                    gint start, gint length,
                    const char *format, ...)

doc/README.developer gives the prototypes for many/most of the relevant proto_tree.... functions.

Also: you can look in the source file (epan/proto.c) to see the actual function definitions.