#include #include typedef struct { ngx_uint_t read_state; ngx_log_t *log; ngx_pool_t *pool; ngx_chain_t *output; } mun_dns_request; static ngx_command_t ngx_muninn_commands[] = {}; static ngx_core_module_t ngx_muninn_module_ctx = { ngx_string("muninn"), NULL, // create conf NULL // init conf }; ngx_module_t ngx_muninn_core_module = { NGX_MODULE_V1, &ngx_muninn_module_ctx, /* module context */ ngx_muninn_commands, /* module directives */ NGX_CORE_MODULE, /* module type */ NULL, /* init master */ NULL, /* init module */ NULL, /* init process */ NULL, /* init thread */ NULL, /* exit thread */ NULL, /* exit process */ NULL, /* exit master */ NGX_MODULE_V1_PADDING }; static void (*mun_read_handler_list[])(ngx_event_t *) = { // list of function pointers }; static ngx_uint_t mun_read_handler_adjacency[][7] = { /* Entries: * { NGX_OK next handler * NGX_ERROR next handler * NGX_AGAIN next handler * NGX_BUSY next handler * NGX_DONE next handler * NGX_DECLINED next handler * NGX_ABORT next handler } * * next handler = index into mun_read_handler_list * ALL INDEXES BETWEEN THIS AND mun_read_handler_list MUST Match */ }; // configuration directives to make a configuration interface // postconfiguration hook that actually does the work of setting up an event loop // - calls ngx_create_listening based on sockaddr and socklen // - sets listening->handler (see ngx_http_init_connection) // - sets listening->pool_size // - sets all this shit (see ngx_http_add_listening) // listening-> init connection handler // close connection function for error handling // set up read event handler for conn->read->handler // set up write event handler for conn->write->handler // make a new request obj and set c->data // figure out how a read is actually done // figure out how a write is actually done