#include #include #include #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 sockaddr *client; 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);