14 #include <wireshark.h>
30 WS_PLUGIN_SCOPE_GLOBAL,
34 #define WS_PLUGIN_SPDX_GPLv2 "GPL-2.0-or-later"
35 #define WS_PLUGIN_GITLAB_URL "https://gitlab.com/wireshark/wireshark"
37 #define WS_PLUGIN_DESC_DISSECTOR (1UL << 0)
38 #define WS_PLUGIN_DESC_FILE_TYPE (1UL << 1)
39 #define WS_PLUGIN_DESC_CODEC (1UL << 2)
40 #define WS_PLUGIN_DESC_EPAN (1UL << 3)
41 #define WS_PLUGIN_DESC_TAP_LISTENER (1UL << 4)
42 #define WS_PLUGIN_DESC_DFUNCTION (1UL << 5)
44 #if defined(SHARED_MODULE_SUFFIX)
45 #define WS_PLUGIN_MODULE_SUFFIX SHARED_MODULE_SUFFIX
47 #define WS_PLUGIN_MODULE_SUFFIX ".dll"
49 #define WS_PLUGIN_MODULE_SUFFIX ".so"
52 typedef void plugins_t;
54 typedef void (*module_register_func)(void);
62 module_register_func register_cb;
65 typedef plugin_type_e (*ws_load_module_func)(
int *,
int *,
struct ws_module **);
67 WS_DLL_PUBLIC plugins_t *plugins_init(plugin_type_e type);
69 typedef void (*plugin_description_callback)(
const char *name,
const char *version,
70 uint32_t flags,
const char *spdx_id,
71 const char *blurb,
const char *home_url,
72 const char *filename, plugin_scope_e scope,
75 WS_DLL_PUBLIC
void plugins_get_descriptions(plugin_description_callback callback,
void *user_data);
77 WS_DLL_PUBLIC
void plugins_print_description(
const char *name,
const char *version,
78 uint32_t flags,
const char *spdx_id,
79 const char *blurb,
const char *home_url,
80 const char *filename, plugin_scope_e scope,
83 WS_DLL_PUBLIC
void plugins_dump_all(
void);
85 WS_DLL_PUBLIC
int plugins_get_count(
void);
87 WS_DLL_PUBLIC
void plugins_cleanup(plugins_t *plugins);
89 WS_DLL_PUBLIC
bool plugins_supported(
void);
91 WS_DLL_PUBLIC plugin_type_e plugins_check_file(
const char *path);
93 WS_DLL_PUBLIC
char *plugins_pers_type_folder(plugin_type_e type);
95 WS_DLL_PUBLIC
char *plugins_file_suffix(plugin_type_e type);
98 int plugins_api_max_level(plugin_type_e type);
101 int plugins_abi_version(plugin_type_e type);
103 #define WIRESHARK_PLUGIN_REGISTER(type, ptr_, api_level_) \
104 WS_DLL_PUBLIC plugin_type_e \
105 wireshark_load_module(int *abi_version_ptr, int *min_api_level_ptr, \
106 struct ws_module **module_ptr) \
108 if (abi_version_ptr) \
109 *abi_version_ptr = WIRESHARK_ABI_VERSION_ ## type; \
110 if (min_api_level_ptr) \
111 *min_api_level_ptr = api_level_; \
113 *module_ptr = ptr_; \
114 return WS_PLUGIN_ ## type; \
117 #define WIRESHARK_PLUGIN_REGISTER_EPAN(ptr, level) \
118 WIRESHARK_PLUGIN_REGISTER(EPAN, ptr, level)
120 #define WIRESHARK_PLUGIN_REGISTER_WIRETAP(ptr, level) \
121 WIRESHARK_PLUGIN_REGISTER(WIRETAP, ptr, level)
123 #define WIRESHARK_PLUGIN_REGISTER_CODEC(ptr, level) \
124 WIRESHARK_PLUGIN_REGISTER(CODEC, ptr, level)