MINOR: contrib: Make the wireshark peers dissector compile for more distribs.
With a 2.6.8 wireshark, this module could not compile because of ws_version.h
missing header. This patch offers the possibility to compile this plugin without
having to include this header. Furthermore with my wireshark version a
"plugin_release" object is required to make it be loaded by wireshark. This is
a string which seems to have to match a dotted string made of you wireshark
major and minor versions.
diff --git a/contrib/wireshark-dissectors/peers/Makefile b/contrib/wireshark-dissectors/peers/Makefile
index 9e70802..95149e7 100644
--- a/contrib/wireshark-dissectors/peers/Makefile
+++ b/contrib/wireshark-dissectors/peers/Makefile
@@ -1,4 +1,4 @@
-CFLAGS = `pkg-config --cflags wireshark` -g -fPIC
+CFLAGS = `pkg-config --cflags wireshark` -g -fPIC $(OPTS)
LDFLAGS = `pkg-config --libs wireshark`
NAME = packet-happp.so
diff --git a/contrib/wireshark-dissectors/peers/README b/contrib/wireshark-dissectors/peers/README
index 78cafcd..83b57d2 100644
--- a/contrib/wireshark-dissectors/peers/README
+++ b/contrib/wireshark-dissectors/peers/README
@@ -37,6 +37,16 @@
$ make
+It is possible that depending on your distribution the compilation may fail
+with such an error:
+
+ packet-happp.c:40:10: fatal error: ws_version.h: No such file or directory
+ #include <ws_version.h>
+
+In this case try to build this plugins with this OPTS variable:
+
+$ OPTS=-DWITHOUT_WS_VERSION make
+
To install it in your home directory:
$ make install
diff --git a/contrib/wireshark-dissectors/peers/packet-happp.c b/contrib/wireshark-dissectors/peers/packet-happp.c
index 3490d8b..a5e2564 100644
--- a/contrib/wireshark-dissectors/peers/packet-happp.c
+++ b/contrib/wireshark-dissectors/peers/packet-happp.c
@@ -36,9 +36,25 @@
#include <epan/dissectors/packet-tcp.h>
#include <epan/tvbuff.h>
+#ifndef WITHOUT_WS_VERSION
#include <ws_version.h>
+#endif
+
+#ifndef WIRESHARK_VERSION_MAJOR
+#define WIRESHARK_VERSION_MAJOR VERSION_MAJOR
+#endif
+#ifndef WIRESHARK_VERSION_MINOR
+#define WIRESHARK_VERSION_MINOR VERSION_MINOR
+#endif
+#ifndef WIRESHARK_VERSION_MICRO
+#define WIRESHARK_VERSION_MICRO VERSION_MICRO
+#endif
+
+#define HAPP_STR(str) #str
+#define HAPP_XSTR(str) HAPP_STR(str)
WS_DLL_PUBLIC_DEF const gchar plugin_version[] = "0.0.1";
+WS_DLL_PUBLIC_DEF const gchar plugin_release[] = HAPP_XSTR(WIRESHARK_VERSION_MAJOR.WIRESHARK_VERSION_MINOR);
WS_DLL_PUBLIC_DEF const int plugin_want_major = WIRESHARK_VERSION_MAJOR;
WS_DLL_PUBLIC_DEF const int plugin_want_minor = WIRESHARK_VERSION_MINOR;
WS_DLL_PUBLIC void plugin_register(void);