From eb0f8a028cf7ddb1b708ee97e6a9c777b45d4d4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Janouch?= Date: Sun, 18 Jan 2015 04:07:05 +0100 Subject: Implement a Lua 5.3 plugin loader plugin Also implemented SOCKS detection in said language. There are probably going to be some bugs. The program is no longer Valgrind-clean, as that would require plugin deinitialization, in which there is very little point. --- ponymap.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'ponymap.c') diff --git a/ponymap.c b/ponymap.c index c1cca02..1ab521a 100644 --- a/ponymap.c +++ b/ponymap.c @@ -623,7 +623,7 @@ unit_start_scan (struct unit *u) u->scan_started = true; poller_timer_set (&u->timeout_event, u->target->ctx->scan_timeout * 1000); - u->service_data = u->service->scan_init (u); + u->service_data = u->service->scan_init (u->service, u); u->fd_event.dispatcher = (poller_fd_fn) on_unit_ready; unit_update_poller (u, NULL); } @@ -791,6 +791,13 @@ plugin_api_register_service (void *app_context, struct service *info) str_map_set (&ctx->services, info->name, info); } +static const char * +plugin_api_get_config (void *app_context, const char *key) +{ + struct app_context *ctx = app_context; + return str_map_find (&ctx->config, key); +} + static const char * plugin_api_unit_get_address (struct unit *u) { @@ -828,6 +835,7 @@ plugin_api_unit_abort (struct unit *u) static struct plugin_api g_plugin_vtable = { .register_service = plugin_api_register_service, + .get_config = plugin_api_get_config, .unit_get_address = plugin_api_unit_get_address, .unit_write = plugin_api_unit_write, .unit_set_success = plugin_api_unit_set_success, -- cgit v1.2.3