WIP: request and connection machine

Just need a simple request logging phase to wrap this up

Signed-off-by: Ava Affine <ava@sunnypup.io>
This commit is contained in:
Ava Apples Affine 2026-05-04 20:29:35 +00:00
parent 19fafc6a8c
commit abe3fc15a9
12 changed files with 492 additions and 4254 deletions

50
muninn.h Normal file
View file

@ -0,0 +1,50 @@
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_event.h>
#define NGX_MUNINN_MODULE 0x42000000
#define NGX_MUNINN_CONF 0x00000086
#define MUN_DNS_LEGACY_UDP_SZ 512
#define MUN_DEFAULT_CONN_POOL_SZ 1024
/* TODO: (in muninn.h)
* need a global tree structure for storing records.
* should store both nameservers, empty non-leaves, and leaf node DNS records.
*
* if possible some text hashing function for fast lookup.
*
* cache lookup should return closest matching record in tree
*
* data structure needs to be atomic
*
* STORE IN SHARED MEMORY
*/
typedef struct mun_dns_request {
ngx_chain_t *in, *out;
ngx_pool_t *pool;
ngx_log_t *log;
ngx_uint_t err_ct;
//TODO: record cache lookup closest result
ngx_event_t *ev;
struct dep_list {
struct mun_dns_request *dependency;
struct dep_list *next;
} *dependencies;
struct mun_dns_request *dependent;
} mun_dns_request;
// request phase handlers
void mun_dns_cache_lookup(ngx_event_t *ev);
void mun_dns_prep_record_fetch(ngx_event_t *ev);
void mun_dns_record_fetch(ngx_event_t *ev);
void mun_postpone_request(ngx_event_t *ev);
void mun_dns_record_response(ngx_event_t *ev);
void mun_handle_request_error(ngx_event_t *ev);
void mun_request_teardown(ngx_event_t *ev);