The ability to respond to and process datagrams Signed-off-by: Ava Affine <ava@sunnypup.io>
55 lines
1.2 KiB
C
55 lines
1.2 KiB
C
#include "muninn.h"
|
|
|
|
|
|
static char *mun_conf_server(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
|
static void *mun_core_create_conf(ngx_cycle_t *cycle);
|
|
|
|
|
|
static ngx_command_t ngx_muninn_core_commands[] = {
|
|
{ ngx_string("muninn"),
|
|
NGX_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS,
|
|
mun_conf_server,
|
|
0, 0, NULL },
|
|
|
|
ngx_null_command
|
|
};
|
|
|
|
static ngx_core_module_t ngx_muninn_core_module_ctx = {
|
|
ngx_string("muninn_core"),
|
|
mun_core_create_conf,
|
|
NULL,
|
|
};
|
|
|
|
ngx_module_t ngx_muninn_core_module = {
|
|
NGX_MODULE_V1,
|
|
&ngx_muninn_core_module_ctx,
|
|
ngx_muninn_core_commands,
|
|
NGX_CORE_MODULE,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NGX_MODULE_V1_PADDING
|
|
};
|
|
|
|
|
|
static void *mun_core_create_conf(ngx_cycle_t *cycle) {
|
|
ngx_int_t *conf;
|
|
if (!(conf = ngx_pcalloc(cycle->pool, sizeof(ngx_int_t))))
|
|
return NULL;
|
|
|
|
return conf;
|
|
}
|
|
|
|
static char *mun_conf_server(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) {
|
|
if (!conf) return "no conf";
|
|
if (**(ngx_int_t **) conf) return "duplicate block";
|
|
|
|
**(ngx_int_t **)conf = 1;
|
|
cf->module_type = NGX_MUNINN_MODULE;
|
|
cf->cmd_type = NGX_MUNINN_CONF;
|
|
return ngx_conf_parse(cf, NULL);
|
|
}
|