diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2012-07-09 21:45:03 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2012-07-09 21:45:03 +0400 |
commit | 7ef494782ccfa6dfdd8bc2187cba43628535277b (patch) | |
tree | 3431645ae267d5dfe90f6f2080a1dc04422bbcaf /src/lua/lua_config.c | |
parent | 4c1013a28f6cb90735c4554b8946414c44f28fdc (diff) | |
download | rspamd-7ef494782ccfa6dfdd8bc2187cba43628535277b.tar.gz rspamd-7ef494782ccfa6dfdd8bc2187cba43628535277b.zip |
* Add async_session and memory pool objects lua bindings.
Diffstat (limited to 'src/lua/lua_config.c')
-rw-r--r-- | src/lua/lua_config.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c index 0e63f6421..2258c03aa 100644 --- a/src/lua/lua_config.c +++ b/src/lua/lua_config.c @@ -35,6 +35,7 @@ /* Config file methods */ LUA_FUNCTION_DEF (config, get_module_opt); LUA_FUNCTION_DEF (config, get_all_opt); +LUA_FUNCTION_DEF (config, get_mempool); LUA_FUNCTION_DEF (config, register_function); LUA_FUNCTION_DEF (config, add_radix_map); LUA_FUNCTION_DEF (config, add_hash_map); @@ -51,6 +52,7 @@ LUA_FUNCTION_DEF (config, get_api_version); static const struct luaL_reg configlib_m[] = { LUA_INTERFACE_DEF (config, get_module_opt), + LUA_INTERFACE_DEF (config, get_mempool), LUA_INTERFACE_DEF (config, get_all_opt), LUA_INTERFACE_DEF (config, register_function), LUA_INTERFACE_DEF (config, add_radix_map), @@ -169,6 +171,20 @@ lua_config_get_module_opt (lua_State * L) return 1; } +static int +lua_config_get_mempool (lua_State * L) +{ + memory_pool_t **ppool; + struct config_file *cfg = lua_check_config (L); + + if (cfg != NULL) { + ppool = lua_newuserdata (L, sizeof (memory_pool_t *)); + lua_setclass (L, "rspamd{mempool}", -1); + *ppool = cfg->cfg_pool; + } + return 1; +} + static gint opt_compare (gconstpointer a, gconstpointer b) { |