summaryrefslogtreecommitdiff
path: root/usr.sbin/unbound/dynlibmod
diff options
context:
space:
mode:
authorStuart Henderson <sthen@cvs.openbsd.org>2021-03-12 19:44:13 +0000
committerStuart Henderson <sthen@cvs.openbsd.org>2021-03-12 19:44:13 +0000
commit2a21ba36c5b37f064870005394f59736112f8e8d (patch)
treea98ee8e61d3b4fc6d4c5c2dc3f491fb2f591f142 /usr.sbin/unbound/dynlibmod
parent8690d7b906b957f3b08f00a5ac36089d4f0f0511 (diff)
update to unbound-1.13.1, tested by gnezdo@
Diffstat (limited to 'usr.sbin/unbound/dynlibmod')
-rw-r--r--usr.sbin/unbound/dynlibmod/dynlibmod.c20
-rw-r--r--usr.sbin/unbound/dynlibmod/dynlibmod.h4
-rw-r--r--usr.sbin/unbound/dynlibmod/examples/helloworld.c14
3 files changed, 20 insertions, 18 deletions
diff --git a/usr.sbin/unbound/dynlibmod/dynlibmod.c b/usr.sbin/unbound/dynlibmod/dynlibmod.c
index 3bf9d1acb0b..ffac7ff306a 100644
--- a/usr.sbin/unbound/dynlibmod/dynlibmod.c
+++ b/usr.sbin/unbound/dynlibmod/dynlibmod.c
@@ -5,16 +5,16 @@
* module actions.
*/
#include "config.h"
+#include "dynlibmod/dynlibmod.h"
#include "util/module.h"
#include "util/config_file.h"
-#include "dynlibmod/dynlibmod.h"
#if HAVE_WINDOWS_H
#include <windows.h>
#define __DYNMOD HMODULE
#define __DYNSYM FARPROC
#define __LOADSYM GetProcAddress
-void log_dlerror() {
+static void log_dlerror() {
DWORD dwLastError = GetLastError();
LPSTR MessageBuffer;
DWORD dwBufferLength;
@@ -37,11 +37,11 @@ void log_dlerror() {
}
-HMODULE open_library(const char* fname) {
+static HMODULE open_library(const char* fname) {
return LoadLibrary(fname);
}
-void close_library(const char* fname, __DYNMOD handle) {
+static void close_library(const char* fname, __DYNMOD handle) {
(void)fname;
(void)handle;
}
@@ -50,15 +50,15 @@ void close_library(const char* fname, __DYNMOD handle) {
#define __DYNMOD void*
#define __DYNSYM void*
#define __LOADSYM dlsym
-void log_dlerror() {
+static void log_dlerror() {
log_err("dynlibmod: %s", dlerror());
}
-void* open_library(const char* fname) {
+static void* open_library(const char* fname) {
return dlopen(fname, RTLD_LAZY | RTLD_GLOBAL);
}
-void close_library(const char* fname, __DYNMOD handle) {
+static void close_library(const char* fname, __DYNMOD handle) {
if(!handle) return;
if(dlclose(handle) != 0) {
log_err("dlclose %s: %s", fname, strerror(errno));
@@ -212,10 +212,10 @@ size_t dynlibmod_get_mem(struct module_env* env, int id) {
int dynlib_inplace_cb_reply_generic(struct query_info* qinfo,
struct module_qstate* qstate, struct reply_info* rep, int rcode,
struct edns_data* edns, struct edns_option** opt_list_out,
- struct comm_reply* repinfo, struct regional* region, int id,
- void* callback) {
+ struct comm_reply* repinfo, struct regional* region,
+ struct timeval* start_time, int id, void* callback) {
struct cb_pair* cb_pair = (struct cb_pair*) callback;
- return ((inplace_cb_reply_func_type*) cb_pair->cb)(qinfo, qstate, rep, rcode, edns, opt_list_out, repinfo, region, id, cb_pair->cb_arg);
+ return ((inplace_cb_reply_func_type*) cb_pair->cb)(qinfo, qstate, rep, rcode, edns, opt_list_out, repinfo, region, start_time, id, cb_pair->cb_arg);
}
int dynlib_inplace_cb_query_generic(struct query_info* qinfo, uint16_t flags,
diff --git a/usr.sbin/unbound/dynlibmod/dynlibmod.h b/usr.sbin/unbound/dynlibmod/dynlibmod.h
index c34cf0e88d9..321f4f6936f 100644
--- a/usr.sbin/unbound/dynlibmod/dynlibmod.h
+++ b/usr.sbin/unbound/dynlibmod/dynlibmod.h
@@ -70,8 +70,8 @@ size_t dynlibmod_get_mem(struct module_env* env, int id);
int dynlib_inplace_cb_reply_generic(struct query_info* qinfo,
struct module_qstate* qstate, struct reply_info* rep, int rcode,
struct edns_data* edns, struct edns_option** opt_list_out,
- struct comm_reply* repinfo, struct regional* region, int id,
- void* callback);
+ struct comm_reply* repinfo, struct regional* region,
+ struct timeval* start_time, int id, void* callback);
int dynlib_inplace_cb_query_generic(struct query_info* qinfo, uint16_t flags,
struct module_qstate* qstate, struct sockaddr_storage* addr,
diff --git a/usr.sbin/unbound/dynlibmod/examples/helloworld.c b/usr.sbin/unbound/dynlibmod/examples/helloworld.c
index acb6b5d9bda..be21168430a 100644
--- a/usr.sbin/unbound/dynlibmod/examples/helloworld.c
+++ b/usr.sbin/unbound/dynlibmod/examples/helloworld.c
@@ -7,8 +7,10 @@
* And to build for windows, first make unbound with the --with-dynlibmod
* switch, then use this command:
* x86_64-w64-mingw32-gcc -m64 -I../.. -shared -Wall -Werror -fpic
- * -o helloworld.dll helloworld.c -L../.. -l:libunbound.a
- * to cross-compile a 64-bit Windows DLL.
+ * -o helloworld.dll helloworld.c -L../.. -l:libunbound.dll.a
+ * to cross-compile a 64-bit Windows DLL. The libunbound.dll.a is produced
+ * by the compile step that makes unbound.exe and allows the dynlib dll to
+ * access definitions in unbound.exe.
*/
#include "../../config.h"
@@ -30,8 +32,8 @@
int reply_callback(struct query_info* qinfo,
struct module_qstate* qstate, struct reply_info* rep, int rcode,
struct edns_data* edns, struct edns_option** opt_list_out,
- struct comm_reply* repinfo, struct regional* region, int id,
- void* callback);
+ struct comm_reply* repinfo, struct regional* region,
+ struct timeval* start_time, int id, void* callback);
/* Init is called when the module is first loaded. It should be used to set up
* the environment for this module and do any other initialisation required. */
@@ -116,8 +118,8 @@ EXPORT size_t get_mem(struct module_env* env, int id) {
int reply_callback(struct query_info* qinfo,
struct module_qstate* qstate, struct reply_info* rep, int rcode,
struct edns_data* edns, struct edns_option** opt_list_out,
- struct comm_reply* repinfo, struct regional* region, int id,
- void* callback) {
+ struct comm_reply* repinfo, struct regional* region,
+ struct timeval* start_time, int id, void* callback) {
log_info("dynlib: hello world from callback");
struct dynlibmod_env* env = qstate->env->modinfo[id];
if (env->dyn_env != NULL) {