summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nxt_application.c3
-rw-r--r--src/nxt_application.h7
-rw-r--r--src/nxt_conf_validation.c12
-rw-r--r--src/nxt_main_process.c11
-rw-r--r--src/nxt_router.c1
-rw-r--r--src/skel/nxt_skel.c77
6 files changed, 111 insertions, 0 deletions
diff --git a/src/nxt_application.c b/src/nxt_application.c
index 629aa11c..3c423033 100644
--- a/src/nxt_application.c
+++ b/src/nxt_application.c
@@ -1114,6 +1114,9 @@ nxt_app_parse_type(u_char *p, size_t length)
} else if (nxt_str_eq(&str, "wasm", 4)) {
return NXT_APP_WASM;
+
+ } else if (nxt_str_eq(&str, "skel", 4)) {
+ return NXT_APP_SKEL;
}
return NXT_APP_UNKNOWN;
diff --git a/src/nxt_application.h b/src/nxt_application.h
index a3b4230a..3668697a 100644
--- a/src/nxt_application.h
+++ b/src/nxt_application.h
@@ -23,6 +23,7 @@ typedef enum {
NXT_APP_JAVA,
NXT_APP_WASM,
NXT_APP_WASM_WC,
+ NXT_APP_SKEL,
NXT_APP_UNKNOWN,
} nxt_app_type_t;
@@ -113,6 +114,11 @@ typedef struct {
} nxt_wasm_wc_app_conf_t;
+typedef struct {
+ char *module;
+} nxt_skel_app_conf_t;
+
+
struct nxt_common_app_conf_s {
nxt_str_t name;
nxt_str_t type;
@@ -143,6 +149,7 @@ struct nxt_common_app_conf_s {
nxt_java_app_conf_t java;
nxt_wasm_app_conf_t wasm;
nxt_wasm_wc_app_conf_t wasm_wc;
+ nxt_skel_app_conf_t skel;
} u;
nxt_conf_value_t *self;
diff --git a/src/nxt_conf_validation.c b/src/nxt_conf_validation.c
index a0b4992f..6c473055 100644
--- a/src/nxt_conf_validation.c
+++ b/src/nxt_conf_validation.c
@@ -1203,6 +1203,17 @@ static nxt_conf_vldt_object_t nxt_conf_vldt_wasm_access_members[] = {
};
+static nxt_conf_vldt_object_t nxt_conf_vldt_skel_members[] = {
+ {
+ .name = nxt_string("module"),
+ .type = NXT_CONF_VLDT_STRING,
+ .flags = NXT_CONF_VLDT_REQUIRED,
+ },
+
+ NXT_CONF_VLDT_NEXT(nxt_conf_vldt_common_members)
+};
+
+
static nxt_conf_vldt_object_t nxt_conf_vldt_common_members[] = {
{
.name = nxt_string("type"),
@@ -2872,6 +2883,7 @@ nxt_conf_vldt_app(nxt_conf_validation_t *vldt, nxt_str_t *name,
{ nxt_conf_vldt_object, nxt_conf_vldt_java_members },
{ nxt_conf_vldt_object, nxt_conf_vldt_wasm_members },
{ nxt_conf_vldt_object, nxt_conf_vldt_wasm_wc_members },
+ { nxt_conf_vldt_object, nxt_conf_vldt_skel_members },
};
ret = nxt_conf_vldt_type(vldt, name, value, NXT_CONF_VLDT_OBJECT);
diff --git a/src/nxt_main_process.c b/src/nxt_main_process.c
index e942c1a8..97a19aee 100644
--- a/src/nxt_main_process.c
+++ b/src/nxt_main_process.c
@@ -391,6 +391,16 @@ static nxt_conf_map_t nxt_wasm_wc_app_conf[] = {
};
+static nxt_conf_map_t nxt_skel_app_conf[] = {
+ {
+ nxt_string("module"),
+ NXT_CONF_MAP_CSTRZ,
+ offsetof(nxt_common_app_conf_t, u.skel.module),
+ },
+
+};
+
+
static nxt_conf_app_map_t nxt_app_maps[] = {
{ nxt_nitems(nxt_external_app_conf), nxt_external_app_conf },
{ nxt_nitems(nxt_python_app_conf), nxt_python_app_conf },
@@ -400,6 +410,7 @@ static nxt_conf_app_map_t nxt_app_maps[] = {
{ nxt_nitems(nxt_java_app_conf), nxt_java_app_conf },
{ nxt_nitems(nxt_wasm_app_conf), nxt_wasm_app_conf },
{ nxt_nitems(nxt_wasm_wc_app_conf), nxt_wasm_wc_app_conf },
+ { nxt_nitems(nxt_skel_app_conf), nxt_skel_app_conf },
};
diff --git a/src/nxt_router.c b/src/nxt_router.c
index 44ea823b..41e00513 100644
--- a/src/nxt_router.c
+++ b/src/nxt_router.c
@@ -288,6 +288,7 @@ static const nxt_str_t *nxt_app_msg_prefix[] = {
[NXT_APP_JAVA] = &empty_prefix,
[NXT_APP_WASM] = &empty_prefix,
[NXT_APP_WASM_WC] = &empty_prefix,
+ [NXT_APP_SKEL] = &empty_prefix,
};
diff --git a/src/skel/nxt_skel.c b/src/skel/nxt_skel.c
new file mode 100644
index 00000000..52e69eab
--- /dev/null
+++ b/src/skel/nxt_skel.c
@@ -0,0 +1,77 @@
+#include <nxt_main.h>
+#include <nxt_application.h>
+#include <nxt_unit.h>
+#include <nxt_unit_request.h>
+
+
+#define SKEL_VERSION "1.0"
+
+
+static uint32_t compat[] = {
+ NXT_VERNUM, NXT_DEBUG,
+};
+
+static nxt_unit_ctx_t *nxt_skel_unit_ctx;
+
+
+static void
+nxt_skel_request_handler(nxt_unit_request_info_t *req)
+{
+ printf("%s: \n", __func__);
+}
+
+
+static nxt_int_t
+nxt_skel_setup(nxt_task_t *task, nxt_process_t *process,
+ nxt_common_app_conf_t *conf)
+{
+ printf("%s: \n", __func__);
+
+ return NXT_OK;
+}
+
+
+static nxt_int_t
+nxt_skel_start(nxt_task_t *task, nxt_process_data_t *data)
+{
+ nxt_int_t ret;
+ nxt_unit_ctx_t *unit_ctx;
+ nxt_unit_init_t skel_init;
+ nxt_common_app_conf_t *conf;
+
+ printf("%s: \n", __func__);
+
+ conf = data->app;
+
+ ret = nxt_unit_default_init(task, &skel_init, conf);
+ if (nxt_slow_path(ret != NXT_OK)) {
+ nxt_alert(task, "nxt_unit_default_init() failed");
+ return ret;
+ }
+
+ skel_init.callbacks.request_handler = nxt_skel_request_handler;
+
+ unit_ctx = nxt_unit_init(&skel_init);
+ if (nxt_slow_path(unit_ctx == NULL)) {
+ return NXT_ERROR;
+ }
+
+ nxt_skel_unit_ctx = unit_ctx;
+
+ nxt_unit_run(nxt_skel_unit_ctx);
+ nxt_unit_done(nxt_skel_unit_ctx);
+
+ exit(EXIT_SUCCESS);
+}
+
+
+NXT_EXPORT nxt_app_module_t nxt_app_module = {
+ sizeof(compat),
+ compat,
+ nxt_string("skel"),
+ SKEL_VERSION,
+ NULL,
+ 0,
+ nxt_skel_setup,
+ nxt_skel_start,
+};