commit 4e2ca90095df2bacf06e72cdbe3c673713650578
parent cef5ac4003dd272e87dab65ef7dbdce5203516a2
Author: Joris Vink <joris@coders.se>
Date: Mon, 11 Jan 2021 23:58:26 +0100
Move Kore hook functions to kore/hooks.h.
Diffstat:
9 files changed, 38 insertions(+), 11 deletions(-)
diff --git a/examples/async-curl/src/init.c b/examples/async-curl/src/init.c
@@ -15,6 +15,7 @@
*/
#include <kore/kore.h>
+#include <kore/hooks.h>
/* Let kore handle the default option parsing. */
void
diff --git a/examples/nohttp/src/init.c b/examples/nohttp/src/init.c
@@ -15,6 +15,7 @@
*/
#include <kore/kore.h>
+#include <kore/hooks.h>
/* Let kore handle the default option parsing. */
void
diff --git a/examples/pipe_task/src/init.c b/examples/pipe_task/src/init.c
@@ -15,6 +15,7 @@
*/
#include <kore/kore.h>
+#include <kore/hooks.h>
/* Let kore handle the default option parsing. */
void
diff --git a/examples/python-async/src/init.c b/examples/python-async/src/init.c
@@ -15,6 +15,7 @@
*/
#include <kore/kore.h>
+#include <kore/hooks.h>
/* Let kore handle the default option parsing. */
void
diff --git a/examples/python-echo/src/init.c b/examples/python-echo/src/init.c
@@ -15,6 +15,7 @@
*/
#include <kore/kore.h>
+#include <kore/hooks.h>
/* Let kore handle the default option parsing. */
void
diff --git a/examples/tasks/src/init.c b/examples/tasks/src/init.c
@@ -15,6 +15,7 @@
*/
#include <kore/kore.h>
+#include <kore/hooks.h>
/* Let kore handle the default option parsing. */
void
diff --git a/include/kore/hooks.h b/include/kore/hooks.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2021 Joris Vink <joris@coders.se>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef __H_HOOKS_H
+#define __H_HOOKS_H
+
+#define KORE_CONFIG_HOOK "kore_parent_configure"
+#define KORE_TEARDOWN_HOOK "kore_parent_teardown"
+#define KORE_DAEMONIZED_HOOK "kore_parent_daemonized"
+
+void kore_seccomp_hook(void);
+void kore_worker_teardown(void);
+void kore_parent_teardown(void);
+void kore_worker_configure(void);
+void kore_parent_daemonized(void);
+void kore_parent_configure(int, char **);
+
+#endif
diff --git a/include/kore/kore.h b/include/kore/kore.h
@@ -100,10 +100,6 @@ extern int daemon(int, int);
#define KORE_PIDFILE_DEFAULT "kore.pid"
#define KORE_DEFAULT_CIPHER_LIST "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK:!kRSA:!kDSA"
-#define KORE_CONFIG_HOOK "kore_parent_configure"
-#define KORE_TEARDOWN_HOOK "kore_parent_teardown"
-#define KORE_DAEMONIZED_HOOK "kore_parent_daemonized"
-
#if defined(KORE_DEBUG)
#define kore_debug(...) \
if (kore_debug) \
@@ -1052,13 +1048,6 @@ struct kore_json_item *kore_json_create_item(struct kore_json_item *,
void kore_keymgr_run(void);
void kore_keymgr_cleanup(int);
-void kore_seccomp_hook(void);
-void kore_worker_teardown(void);
-void kore_parent_teardown(void);
-void kore_worker_configure(void);
-void kore_parent_daemonized(void);
-void kore_parent_configure(int, char **);
-
#if defined(__cplusplus)
}
#endif
diff --git a/src/kore.c b/src/kore.c
@@ -28,6 +28,7 @@
#include <signal.h>
#include "kore.h"
+#include "hooks.h"
#if !defined(KORE_NO_HTTP)
#include "http.h"