I'm trying to install a protobuf dissector, the generic dissector from this git repo: https://code.google.com/p/protobuf-wireshark/downloads/list. The protobuf dissector has a script that compiles the code, and sticks it into your plug-ins directory. The issue is that I intend to create an installer so I can distribute my build, but I think that creating an installer with the generated .so or .o file would create dependencies on the C compiler. (If I'm wrong and it wouldn't then great, I can just do that) The file packet-GoogleProtoBuf.c calls an external function that is in a C++ file. I need to add wireshark-glue-GoogleProtobuf.cc to the makefiles, but it needs to be compiled as a C++ file, which as far as I know is not officially supported by Wireshark. Is there a way I can add this file so it will get built and linked? And if there is, and I create an installer, will it be included in the installer and be usable without creating new dependencies? asked 23 Jul '15, 08:12 broccollirob |
I don't know anything about including it in the installer and such, but Wireshark has been compiled with a C++ compiler for a while now - the Qt-based alternative GUI in 1.12.x and default GUI in the current 1.99.x development branch is C++ code. Of course a lot of wireshark's internals are still compiled as C and linked with
extern "C"
wrappers and so forth; which is presumably whywireshark-glue-GoogleProtoBuf.cc
uses theextern "C"
wrapper as well.But if you can compile it as a separate plugin today, I don't see why you can't as part of the installer's package, but still remain as a plugin - Wireshark already ships with some other plugins today.
OK, so I added the files the way you normally add dissectors, and it's giving me this error. It's getting confused and making an .objc file, which is not what it wants. Any ideas?
Making register.c (using python) Registering 1262 files, 1262 cached Cache hits: 1262, misses: 0 Updating register.c NMAKE : fatal error U1073: don't know how to make 'wireshark-glue-GoogleProtoBuf .objc' Stop. NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0 \VC\BIN\nmake.exe"' : return code '0x2' Stop. NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0 \VC\BIN\nmake.exe"' : return code '0x2' Stop.
And heres how I added to the Makefiles:
CMakelists.txt: dissectors/packet-SrcMessage-gryp-0xf18f.c dissectors/packet-GoogleProtoBuf.c dissectors/wireshark-glue-GoogleProtoBuf.cc dissectors/packet-2dparityfec.c dissectors/packet-3com-njack.c dissectors/packet-3com-xns.c
Makefile.common: packet-GoogleProtoBuf.c \ wireshark-glue-GoogleProtoBuf.cc \ packet-2dparityfec.c \ packet-3com-njack.c \
Unfortunately I'm not the right guy for that type of info, but I'll try to help with the little I know:
You definitely won't be able to simply add it in the makefiles as just another dissector. All of the built-in dissectors are pure C-code, and compiled as such.
What you want to do is compile the protobuf thing as a plugin, not a regular built-in dissector. There's a
README.plugins
file in the wireshark source in thedoc
directory you may want to read. And obviously there's theREADME.txt
in the protobuf plugin site's source you pointed to. It looks like the protobuf plugin generator python script creates the necessary makefiles for the plugin, so my guess is it's just a matter of running that script, then invoking those generated makefiles from the installer stuff in wireshark.But again, that's not my area of knowledge for wireshark - I focus more on wireshark's Lua API code. (and as it happens I've been thinking of writing a Lua script for wireshark to decode google's protobuf messages using the
.proto
files)