Wireshark-dev: Re: [Wireshark-dev] [PATCH] draft-ietf-behave-rfc3489bis-07

From: Jeff Morriss <jeff.morriss.ws@xxxxxxxxx>
Date: Mon, 23 Jul 2007 15:37:41 -0400
Marc Petit-Huguenin wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jeff Morriss wrote:
Marc Petit-Huguenin wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

This is an update to the STUN2 dissector using the last draft,
draft-ietf-behave-rfc3489bis-07.
It doesn't compile as is:

 gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I./../.. -I./.. -I/usr/include -I/usr/local/include -Werror -DINET6 "-D_U_=__attribute__((unused))" -g -O2 -Wall -W -Wdeclaration-after-statement -Wendif-labels -Wpointer-arith -I/usr/local/include -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib64/glib/include -I/usr/X11R6/include -MT libcleandissectors_la-packet-stun2.lo -MD -MP -MF .deps/libcleandissectors_la-packet-stun2.Tpo -c packet-stun2.c  -fPIC -DPIC -o .libs/libcleandissectors_la-packet-stun2.o
packet-stun2.c: In function `dissect_stun2_tcp':
packet-stun2.c:398: warning: implicit declaration of function `tcp_dissect_pdus'
packet-stun2.c: In function `proto_reg_handoff_stun2':
packet-stun2.c:548: warning: passing arg 1 of `create_dissector_handle' from incompatible pointer type
packet-stun2.c:549: warning: passing arg 1 of `create_dissector_handle' from incompatible pointer type
packet-stun2.c: At top level:
packet-stun2.c:146: warning: unused parameter 'pinfo'
packet-stun2.c:60: warning: 'stun2_att_password' defined but not used
packet-stun2.c:73: warning: 'stun2_att_refresh_interval' defined but not used
make[1]: *** [libcleandissectors_la-packet-stun2.lo] Error 1
Probably due to mixing new-style (returns int) and old style (returns
nothing) dissectors.  For example:

static int
dissect_stun2_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
        tcp_dissect_pdus(tvb, pinfo, tree, TRUE, STUN2_HDR_LEN,
                        get_stun2_message_len, dissect_stun2_message);
}
will (eventually) generate a warning that the function's not calling return.

Sorry, I don't really have time to clean it up myself now.

Sorry for the mistakes.

Please find attached a new version of the patch.

Checked in (rev 22383), thanks!

BTW, this dissector really should be broken up into multiple functions or something. I reindented it a bit, but the main function really is too big.

A more generic question is: how are dissectors using tcp_dissect_pdus() supposed to be "new style" (this dissector is now effectively no longer "new style"). "packet-xot" takes one approach but it's not obvious to me if that will really work well: it requires the dissector to be given (at least) the PDU header length in the first call.