This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

error: invalid use of incomplete type ‘tvbuff_t

0

I'm trying to build an old dissector with the new wireshark source and I'm facing this compilation problem and am not able to resolve it.

More log: packet-xxx.cpp:467:7: error: invalid use of incomplete type 'tvbuff_t {aka struct tvbuff}' In file included from ../../epan/proto.h:51:0, from ../../epan/packet.h:29, from packet-xxx.cpp:51: ../../epan/tvbuff.h:64:8: error: forward declaration of 'tvbuff_t {aka struct tvbuff}' make: *** [packet-xxx.lo] Error 1

asked 26 Nov '13, 02:05

pysudhir's gravatar image

pysudhir
1324
accept rate: 0%

Are you building a C++ dissector? Not sure that will work.

(26 Nov '13, 04:01) Anders ♦

That is exactly the problem. Could you point me out to the changes in the configure.ac file that are needed to compile a c++ dissecotr?

(26 Nov '13, 22:36) pysudhir

Why not go with the flow and write it in C? That also makes it possible to contribute the code.

(27 Nov '13, 00:24) Anders ♦

@pysudhir

As suggested by @Anders comment, there aren't any C++ dissectors in the mainline Wireshark source code.

External additions to the project (plugins) have used C++, WSGD comes to mind, so maybe look at that.

(27 Nov '13, 01:51) grahamb ♦

One Answer:

0

The problem is that the tvbuff_t structure has been made opaque. That means you cannot do anything with the structure other than store pointers to it and pass them around. That means you can't access, for example, tvb->length. Rather, you must use accessor functions (e.g., tvb_length()).

(The reason the structure is opaque is exactly to ensure that it is only accessed via the accessor functions.)

answered 26 Nov '13, 06:26

JeffMorriss's gravatar image

JeffMorriss ♦
6.2k572
accept rate: 27%