aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/plugins.example/hello.c4
-rwxr-xr-xtools/make-plugin-reg.py4
-rw-r--r--ui/qt/about_dialog.cpp14
-rw-r--r--wsutil/plugins.c30
-rw-r--r--wsutil/plugins.h16
5 files changed, 34 insertions, 34 deletions
diff --git a/doc/plugins.example/hello.c b/doc/plugins.example/hello.c
index 9f369ab8e4..39d7ae4a03 100644
--- a/doc/plugins.example/hello.c
+++ b/doc/plugins.example/hello.c
@@ -22,7 +22,7 @@ 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);
-WS_DLL_PUBLIC int plugin_describe(void);
+WS_DLL_PUBLIC uint32_t plugin_describe(void);
static int proto_hello = -1;
static dissector_handle_t handle_hello;
@@ -58,7 +58,7 @@ plugin_register(void)
proto_register_plugin(&plug);
}
-int
+uint32_t
plugin_describe(void)
{
return WS_PLUGIN_DESC_DISSECTOR;
diff --git a/tools/make-plugin-reg.py b/tools/make-plugin-reg.py
index 766d6d3411..cd2de2f21d 100755
--- a/tools/make-plugin-reg.py
+++ b/tools/make-plugin-reg.py
@@ -153,9 +153,9 @@ WS_DLL_PUBLIC_DEF const int plugin_want_major = VERSION_MAJOR;
WS_DLL_PUBLIC_DEF const int plugin_want_minor = VERSION_MINOR;
WS_DLL_PUBLIC void plugin_register(void);
-WS_DLL_PUBLIC int plugin_describe(void);
+WS_DLL_PUBLIC uint32_t plugin_describe(void);
-int plugin_describe(void)
+uint32_t plugin_describe(void)
{
return %s;
}
diff --git a/ui/qt/about_dialog.cpp b/ui/qt/about_dialog.cpp
index 57ac009630..b563751a8a 100644
--- a/ui/qt/about_dialog.cpp
+++ b/ui/qt/about_dialog.cpp
@@ -102,22 +102,22 @@ QStringList AuthorListModel::headerColumns() const
#ifdef HAVE_PLUGINS
static void plugins_add_description(const char *name, const char *version,
- int desc_flags, const char *filename,
+ uint32_t flags, const char *filename,
void *user_data)
{
QList<QStringList> *plugin_data = (QList<QStringList> *)user_data;
QStringList plugin_types;
- if (desc_flags & WS_PLUGIN_DESC_DISSECTOR)
+ if (flags & WS_PLUGIN_DESC_DISSECTOR)
plugin_types << "dissector";
- if (desc_flags & WS_PLUGIN_DESC_FILE_TYPE)
+ if (flags & WS_PLUGIN_DESC_FILE_TYPE)
plugin_types << "file type";
- if (desc_flags & WS_PLUGIN_DESC_CODEC)
+ if (flags & WS_PLUGIN_DESC_CODEC)
plugin_types << "codec";
- if (desc_flags & WS_PLUGIN_DESC_EPAN)
+ if (flags & WS_PLUGIN_DESC_EPAN)
plugin_types << "epan";
- if (desc_flags & WS_PLUGIN_DESC_TAP_LISTENER)
+ if (flags & WS_PLUGIN_DESC_TAP_LISTENER)
plugin_types << "tap listener";
- if (desc_flags & WS_PLUGIN_DESC_DFILTER)
+ if (flags & WS_PLUGIN_DESC_DFILTER)
plugin_types << "dfilter";
if (plugin_types.empty())
plugin_types << "unknown";
diff --git a/wsutil/plugins.c b/wsutil/plugins.c
index d98342998b..cbb523ee4a 100644
--- a/wsutil/plugins.c
+++ b/wsutil/plugins.c
@@ -30,7 +30,7 @@ typedef struct _plugin {
GModule *handle; /* handle returned by g_module_open */
char *name; /* plugin name */
const char *version; /* plugin version */
- int desc_flags; /* user-facing description flags (what it does) */
+ uint32_t flags; /* plugin flags */
} plugin;
#define TYPE_DIR_EPAN "epan"
@@ -58,21 +58,21 @@ type_to_dir(plugin_type_e type)
}
static inline const char *
-desc_flags_to_str(int type_flags)
+flags_to_str(uint32_t flags)
{
/* XXX: Allow joining multiple types? Our plugins only implement a
* single type but out in the wild this may not be true. */
- if (type_flags & WS_PLUGIN_DESC_DISSECTOR)
+ if (flags & WS_PLUGIN_DESC_DISSECTOR)
return "dissector";
- else if (type_flags & WS_PLUGIN_DESC_FILE_TYPE)
+ else if (flags & WS_PLUGIN_DESC_FILE_TYPE)
return "file type";
- else if (type_flags & WS_PLUGIN_DESC_CODEC)
+ else if (flags & WS_PLUGIN_DESC_CODEC)
return "codec";
- else if (type_flags & WS_PLUGIN_DESC_EPAN)
+ else if (flags & WS_PLUGIN_DESC_EPAN)
return "epan";
- else if (type_flags & WS_PLUGIN_DESC_TAP_LISTENER)
+ else if (flags & WS_PLUGIN_DESC_TAP_LISTENER)
return "tap listener";
- else if (type_flags & WS_PLUGIN_DESC_DFILTER)
+ else if (flags & WS_PLUGIN_DESC_DFILTER)
return "dfilter";
else
return "unknown";
@@ -137,7 +137,7 @@ scan_plugins_dir(GHashTable *plugins_module, const char *dirpath, plugin_type_e
GModule *handle; /* handle returned by g_module_open */
void * symbol;
const char *plug_version;
- int desc_flags;
+ uint32_t flags;
plugin *new_plug;
if (append_type)
@@ -208,15 +208,15 @@ DIAG_ON_PEDANTIC
/* Search for the (optional) description flag registration function */
if (g_module_symbol(handle, "plugin_describe", &symbol))
- desc_flags = ((plugin_describe_func)symbol)();
+ flags = ((plugin_describe_func)symbol)();
else
- desc_flags = 0;
+ flags = 0;
new_plug = g_new(plugin, 1);
new_plug->handle = handle;
new_plug->name = g_strdup(name);
new_plug->version = plug_version;
- new_plug->desc_flags = desc_flags;
+ new_plug->flags = flags;
/* Add it to the list of plugins. */
g_hash_table_replace(plugins_module, new_plug->name, new_plug);
@@ -278,7 +278,7 @@ plugins_get_descriptions(plugin_description_callback callback, void *callback_da
for (unsigned i = 0; i < plugins_array->len; i++) {
plugin *plug = (plugin *)plugins_array->pdata[i];
- callback(plug->name, plug->version, plug->desc_flags, g_module_name(plug->handle), callback_data);
+ callback(plug->name, plug->version, plug->flags, g_module_name(plug->handle), callback_data);
}
g_ptr_array_free(plugins_array, true);
@@ -286,10 +286,10 @@ plugins_get_descriptions(plugin_description_callback callback, void *callback_da
static void
print_plugin_description(const char *name, const char *version,
- int desc_flags, const char *filename,
+ uint32_t flags, const char *filename,
void *user_data _U_)
{
- printf("%-16s\t%s\t%s\t%s\n", name, version, desc_flags_to_str(desc_flags), filename);
+ printf("%-16s\t%s\t%s\t%s\n", name, version, flags_to_str(flags), filename);
}
void
diff --git a/wsutil/plugins.h b/wsutil/plugins.h
index 4481c6c0c8..113f1f687d 100644
--- a/wsutil/plugins.h
+++ b/wsutil/plugins.h
@@ -18,7 +18,7 @@ extern "C" {
#endif /* __cplusplus */
typedef void (*plugin_register_func)(void);
-typedef int (*plugin_describe_func)(void);
+typedef uint32_t (*plugin_describe_func)(void);
typedef void plugins_t;
@@ -28,17 +28,17 @@ typedef enum {
WS_PLUGIN_CODEC
} plugin_type_e;
-#define WS_PLUGIN_DESC_DISSECTOR (1 << 0)
-#define WS_PLUGIN_DESC_FILE_TYPE (1 << 1)
-#define WS_PLUGIN_DESC_CODEC (1 << 2)
-#define WS_PLUGIN_DESC_EPAN (1 << 3)
-#define WS_PLUGIN_DESC_TAP_LISTENER (1 << 4)
-#define WS_PLUGIN_DESC_DFILTER (1 << 5)
+#define WS_PLUGIN_DESC_DISSECTOR (1UL << 0)
+#define WS_PLUGIN_DESC_FILE_TYPE (1UL << 1)
+#define WS_PLUGIN_DESC_CODEC (1UL << 2)
+#define WS_PLUGIN_DESC_EPAN (1UL << 3)
+#define WS_PLUGIN_DESC_TAP_LISTENER (1UL << 4)
+#define WS_PLUGIN_DESC_DFILTER (1UL << 5)
WS_DLL_PUBLIC plugins_t *plugins_init(plugin_type_e type);
typedef void (*plugin_description_callback)(const char *name, const char *version,
- int desc_flags, const char *filename,
+ uint32_t flags, const char *filename,
void *user_data);
WS_DLL_PUBLIC void plugins_get_descriptions(plugin_description_callback callback, void *user_data);