diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-05-24 19:55:37 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-05-24 19:56:05 +0100 |
commit | 25ef6b98215f5518dae638ce0fd6b4710f17b113 (patch) | |
tree | 3bd032e2097a3e65985bb10d1ae926498011086f /src/rspamadm/rspamadm.h | |
parent | bb638f7c7d851f20071f5f9ee77224c0173e73ae (diff) | |
download | rspamd-25ef6b98215f5518dae638ce0fd6b4710f17b113.tar.gz rspamd-25ef6b98215f5518dae638ce0fd6b4710f17b113.zip |
[Project] Rework rspamadm and Lua init path
Diffstat (limited to 'src/rspamadm/rspamadm.h')
-rw-r--r-- | src/rspamadm/rspamadm.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/rspamadm/rspamadm.h b/src/rspamadm/rspamadm.h index 9a209fd91..3f619e52c 100644 --- a/src/rspamadm/rspamadm.h +++ b/src/rspamadm/rspamadm.h @@ -18,16 +18,24 @@ #include "config.h" #include "ucl.h" +#include <lua.h> +#include <lauxlib.h> +#include <lualib.h> extern GHashTable *ucl_vars; +extern lua_State *L; GQuark rspamadm_error (void); -typedef const gchar* (*rspamadm_help_func) (gboolean full_help); -typedef void (*rspamadm_run_func) (gint argc, gchar **argv); +struct rspamadm_command; +typedef const gchar* (*rspamadm_help_func) (gboolean full_help, + const struct rspamadm_command *cmd); +typedef void (*rspamadm_run_func) (gint argc, gchar **argv, + const struct rspamadm_command *cmd); typedef void (*rspamadm_lua_exports_func) (gpointer lua_state); #define RSPAMADM_FLAG_NOHELP (1 << 0) +#define RSPAMADM_FLAG_LUA (1 << 0) struct rspamadm_command { const gchar *name; @@ -35,14 +43,19 @@ struct rspamadm_command { rspamadm_help_func help; rspamadm_run_func run; rspamadm_lua_exports_func lua_subrs; + gint cbref; + gpointer command_data; /* Opaque data */ }; extern const struct rspamadm_command *commands[]; extern struct rspamadm_command help_command; -const struct rspamadm_command *rspamadm_search_command (const gchar *name); +const struct rspamadm_command *rspamadm_search_command (const gchar *name, + GPtrArray *all_commands); +void rspamadm_fill_internal_commands (GPtrArray *dest); gboolean rspamadm_execute_lua_ucl_subr (gpointer L, gint argc, gchar **argv, - const ucl_object_t *res, const gchar *script_name); + const ucl_object_t *res, + const gchar *script_name); #endif |