diff options
author | Guy Harris <guy@alum.mit.edu> | 2013-12-02 08:30:29 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2013-12-02 08:30:29 +0000 |
commit | 0cc1545d05be6f655c950904b1da776190f3af16 (patch) | |
tree | b82725615b527304bfb2e9e7d9f3b6dfc50ce7fd /epan/wslua | |
parent | baf569188ac49ad38912b82d23ff241321cd654f (diff) |
Move most of the plugin code from epan to wsutil and remove all
knowledge of particular types of plugins. Instead, let particular types
of plugins register with the common plugin code, giving a name and a
routine to recognize that type of plugin.
In particular applications, only process the relevant plugin types.
Add a Makefile.common to the codecs directory.
svn path=/trunk/; revision=53710
Diffstat (limited to 'epan/wslua')
-rw-r--r-- | epan/wslua/init_wslua.c | 35 | ||||
-rw-r--r-- | epan/wslua/init_wslua.h | 8 |
2 files changed, 42 insertions, 1 deletions
diff --git a/epan/wslua/init_wslua.c b/epan/wslua/init_wslua.c index afee46d91c..0f353e48e2 100644 --- a/epan/wslua/init_wslua.c +++ b/epan/wslua/init_wslua.c @@ -34,10 +34,19 @@ #include <math.h> #include <epan/expert.h> #include <epan/ex-opt.h> -#include <epan/plugins.h> #include <wsutil/privileges.h> #include <wsutil/file_util.h> +/* linked list of Lua plugins */ +typedef struct _wslua_plugin { + gchar *name; /**< plugin name */ + gchar *version; /**< plugin version */ + gchar *filename; /**< plugin filename */ + struct _wslua_plugin *next; +} wslua_plugin; + +static wslua_plugin *wslua_plugin_list = NULL; + static lua_State* L = NULL; packet_info* lua_pinfo; @@ -360,6 +369,30 @@ int wslua_count_plugins(void) { return plugins_counter; } +void wslua_plugins_get_descriptions(wslua_plugin_description_callback callback, void *user_data) { + wslua_plugin *lua_plug; + + for (lua_plug = wslua_plugin_list; lua_plug != NULL; lua_plug = lua_plug->next) + { + callback(lua_plug->name, lua_plug->version, "lua script", + lua_plug->filename, user_data); + } +} + +static void +print_wslua_plugin_description(const char *name, const char *version, + const char *description, const char *filename, + void *user_data _U_) +{ + printf("%s\t%s\t%s\t%s\n", name, version, description, filename); +} + +void +wslua_plugins_dump_all(void) +{ + wslua_plugins_get_descriptions(print_wslua_plugin_description, NULL); +} + int wslua_init(register_cb cb, gpointer client_data) { gchar* filename; const funnel_ops_t* ops = funnel_get_funnel_ops(); diff --git a/epan/wslua/init_wslua.h b/epan/wslua/init_wslua.h index 9072e6b9b1..72d083eb96 100644 --- a/epan/wslua/init_wslua.h +++ b/epan/wslua/init_wslua.h @@ -25,6 +25,14 @@ #ifndef __INIT_WSLUA_H__ #define __INIT_WSLUA_H__ +#include "ws_symbol_export.h" + WS_DLL_PUBLIC int wslua_count_plugins(void); +typedef void (*wslua_plugin_description_callback)(const char *, const char *, + const char *, const char *, + void *); +WS_DLL_PUBLIC void wslua_plugins_get_descriptions(wslua_plugin_description_callback callback, void *user_data); +WS_DLL_PUBLIC void wslua_plugins_dump_all(void); + #endif /* __INIT_WSLUA_H__ */ |