From nobody Wed Dec 17 04:02:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549625468221671.8199380519671; Fri, 8 Feb 2019 03:31:08 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8494C88E52; Fri, 8 Feb 2019 11:31:05 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 38FEB51F28; Fri, 8 Feb 2019 11:31:05 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id BD7CD18033A6; Fri, 8 Feb 2019 11:31:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x18BTngT027940 for ; Fri, 8 Feb 2019 06:29:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7E1B31796F; Fri, 8 Feb 2019 11:29:49 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 032326090D for ; Fri, 8 Feb 2019 11:29:48 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Fri, 8 Feb 2019 12:23:26 +0100 Message-Id: <26ab68e6fad148d76ca69baeeb0f18d2807158e1.1549624935.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/5] wireshark: Provide registration code for newer wireshark X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 08 Feb 2019 11:31:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" As advertised in previous commits, wireshark has changed the way that plugins register. In fact, it has done so two times since the last time we've touched our code (wireshark v2.5.0 and v2.9.0). Use the wireshark script from respective releases to generate newer registration callbacks and put them into our code. Signed-off-by: Michal Privoznik --- tools/wireshark/src/plugin.c | 61 ++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 6 deletions(-) diff --git a/tools/wireshark/src/plugin.c b/tools/wireshark/src/plugin.c index 2a85688f43..3741334e85 100644 --- a/tools/wireshark/src/plugin.c +++ b/tools/wireshark/src/plugin.c @@ -2,10 +2,10 @@ * plugin.c: Wireshark's plugin registration * * The registration routines were generated using wireshark's - * make-dissector-reg script (found under wirshark.git/tools/): + * make-plugin-reg.py script (found under wirshark.git/tools/): * * libvirt.git/tools/wireshark/src $ \ - * /path/to/wireshark.git/tools/make-dissector-reg \ + * /path/to/wireshark.git/tools/make-plugin-reg.py \ * . plugin packet-libvirt.c * */ @@ -14,20 +14,31 @@ =20 #include =20 +#include +#include /* plugins are DLLs */ #define WS_BUILD_DLL #include =20 #include "packet-libvirt.h" =20 +/* Let the plugin version be the version of libvirt */ +#define PLUGIN_VERSION VERSION + +#define WIRESHARK_VERSION \ + ((VERSION_MAJOR * 1000 * 1000) + \ + (VERSION_MINOR * 1000) + \ + (VERSION_MICRO)) + +#if WIRESHARK_VERSION < 2005000 /* In 1.12 wireshark WS_DLL_PUBLIC_NOEXTERN was substitued with * WS_DLL_PUBLIC_DEF. See wireshark's commit * 5d87a8c46171f572568db5a47c093423482e342f for more info. */ -#ifndef WS_DLL_PUBLIC_NOEXTERN -# define WS_DLL_PUBLIC_NOEXTERN WS_DLL_PUBLIC_DEF -#endif +# ifndef WS_DLL_PUBLIC_NOEXTERN +# define WS_DLL_PUBLIC_NOEXTERN WS_DLL_PUBLIC_DEF +# endif =20 -#ifndef ENABLE_STATIC +# ifndef ENABLE_STATIC WS_DLL_PUBLIC_NOEXTERN const gchar version[] =3D VERSION; =20 /* Start the functions we need for the plugin stuff */ @@ -42,4 +53,42 @@ plugin_reg_handoff(void) { proto_reg_handoff_libvirt(); } +# endif + +#elif WIRESHARK_VERSION < 2009000 + +WS_DLL_PUBLIC_DEF const gchar plugin_version[] =3D PLUGIN_VERSION; +WS_DLL_PUBLIC_DEF const gchar plugin_release[] =3D VERSION_RELEASE; + +WS_DLL_PUBLIC void plugin_register(void); + +void plugin_register(void) +{ + static proto_plugin plug_libvirt; + + plug_libvirt.register_protoinfo =3D proto_register_libvirt; + plug_libvirt.register_handoff =3D proto_reg_handoff_libvirt; + proto_register_plugin(&plug_libvirt); +} + +#else /* WIRESHARK_VERSION >=3D 2009000 */ + +void proto_register_libvirt(void); +void proto_reg_handoff_libvirt(void); + +WS_DLL_PUBLIC_DEF const gchar plugin_version[] =3D PLUGIN_VERSION; +WS_DLL_PUBLIC_DEF const int plugin_want_major =3D VERSION_MAJOR; +WS_DLL_PUBLIC_DEF const int plugin_want_minor =3D VERSION_MINOR; + +WS_DLL_PUBLIC void plugin_register(void); + +void plugin_register(void) +{ + static proto_plugin plug_libvirt; + + plug_libvirt.register_protoinfo =3D proto_register_libvirt; + plug_libvirt.register_handoff =3D proto_reg_handoff_libvirt; + proto_register_plugin(&plug_libvirt); +} + #endif --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list