summaryrefslogtreecommitdiff
path: root/tools/wireshark/src/plugin.c
blob: 13af1b6a73b46e622badf627911475d4341e1bf7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
 * plugin.c: Wireshark's plugin registration
 *
 * The registration routines were generated using wireshark's
 * make-plugin-reg.py script (found under wirshark.git/tools/):
 *
 * libvirt.git/tools/wireshark/src $ \
 *   /path/to/wireshark.git/tools/make-plugin-reg.py \
 *   . plugin packet-libvirt.c
 *
 */

#include <config.h>

#include <gmodule.h>

#ifdef WITH_WS_VERSION
# include <wireshark/ws_version.h>
#else
# include <wireshark/config.h>
# define WIRESHARK_VERSION_MAJOR VERSION_MAJOR
# define WIRESHARK_VERSION_MINOR VERSION_MINOR
# define WIRESHARK_VERSION_MICRO VERSION_MICRO
#endif

#define HAVE_PLUGINS 1
#include <wireshark/epan/proto.h>
/* plugins are DLLs */
#define WS_BUILD_DLL
#include <wireshark/ws_symbol_export.h>

#include "packet-libvirt.h"

/* Let the plugin version be the version of libvirt */
#define PLUGIN_VERSION VERSION

#define WIRESHARK_VERSION \
    ((WIRESHARK_VERSION_MAJOR * 1000 * 1000) + \
     (WIRESHARK_VERSION_MINOR * 1000) + \
     (WIRESHARK_VERSION_MICRO))

#if WIRESHARK_VERSION < 2005000

WS_DLL_PUBLIC_DEF const gchar version[] = VERSION;

/* Start the functions we need for the plugin stuff */

WS_DLL_PUBLIC_DEF void
plugin_register(void)
{
  proto_register_libvirt();
}
WS_DLL_PUBLIC_DEF void
plugin_reg_handoff(void)
{
  proto_reg_handoff_libvirt();
}

#elif WIRESHARK_VERSION < 2009000

WS_DLL_PUBLIC_DEF const gchar plugin_version[] = PLUGIN_VERSION;
WS_DLL_PUBLIC_DEF const gchar plugin_release[] = VERSION_RELEASE;

WS_DLL_PUBLIC void plugin_register(void);

void plugin_register(void)
{
    static proto_plugin plug_libvirt;

    plug_libvirt.register_protoinfo = proto_register_libvirt;
    plug_libvirt.register_handoff = proto_reg_handoff_libvirt;
    proto_register_plugin(&plug_libvirt);
}

#else /* WIRESHARK_VERSION >= 2009000 */

void proto_register_libvirt(void);
void proto_reg_handoff_libvirt(void);

WS_DLL_PUBLIC_DEF const gchar plugin_version[] = PLUGIN_VERSION;
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);

void plugin_register(void)
{
    static proto_plugin plug_libvirt;

    plug_libvirt.register_protoinfo = proto_register_libvirt;
    plug_libvirt.register_handoff = proto_reg_handoff_libvirt;
    proto_register_plugin(&plug_libvirt);
}

#endif