void dnsInit(void) { #if USE_DNSSERVERS static int init = 0; wordlist *w; if (!Config.Program.dnsserver) return; if (dnsservers == NULL) dnsservers = helperCreate("dnsserver"); dnsservers->n_to_start = Config.dnsChildren; dnsservers->ipc_type = IPC_TCP_SOCKET; assert(dnsservers->cmdline == NULL); wordlistAdd(&dnsservers->cmdline, Config.Program.dnsserver); if (Config.onoff.res_defnames) wordlistAdd(&dnsservers->cmdline, "-D"); for (w = Config.dns_nameservers; w != NULL; w = w->next) { wordlistAdd(&dnsservers->cmdline, "-s"); wordlistAdd(&dnsservers->cmdline, w->key); } helperOpenServers(dnsservers); if (!init) { cachemgrRegister("dns", "Dnsserver Statistics", dnsStats, 0, 1); init = 1; } #endif }
void authenticateInit(void) { static int init = 0; if (!Config.Program.authenticate) return; if (authenticators == NULL) authenticators = helperCreate("authenticator"); authenticators->cmdline = Config.Program.authenticate; authenticators->n_to_start = Config.authenticateChildren; authenticators->ipc_type = IPC_TCP_SOCKET; helperOpenServers(authenticators); if (!init) { cachemgrRegister("authenticator", "User Authenticator Stats", authenticateStats, 0, 1); init++; } }
void redirectInit(void) { static int init = 0; if (!Config.Program.redirect) return; if (redirectors == NULL) redirectors = helperCreate("redirector"); redirectors->cmdline = Config.Program.redirect; redirectors->n_to_start = Config.redirectChildren; redirectors->ipc_type = IPC_TCP_SOCKET; helperOpenServers(redirectors); if (!init) { cachemgrRegister("redirector", "URL Redirector Stats", redirectStats, 0, 1); init = 1; CBDATA_INIT_TYPE(redirectStateData); } }
void locationRewriteInit(void) { static int init = 0; if (!Config.Program.location_rewrite.command) return; if (locrewriters == NULL) locrewriters = helperCreate("location_rewriter"); locrewriters->cmdline = Config.Program.location_rewrite.command; locrewriters->n_to_start = Config.Program.location_rewrite.children; locrewriters->concurrency = Config.Program.location_rewrite.concurrency; locrewriters->ipc_type = IPC_STREAM; helperOpenServers(locrewriters); if (!init) { cachemgrRegister("location_rewriter", "Location Rewriter Stats", locationRewriteStats, 0, 1); init = 1; CBDATA_INIT_TYPE(rewriteStateData); } }
void redirectInit(void) { static int init = 0; if (!Config.Program.url_rewrite.command) return; if (redirectors == NULL) redirectors = helperCreate("url_rewriter"); redirectors->cmdline = Config.Program.url_rewrite.command; redirectors->n_to_start = Config.Program.url_rewrite.children; redirectors->concurrency = Config.Program.url_rewrite.concurrency; redirectors->ipc_type = IPC_STREAM; helperOpenServers(redirectors); if (!init) { cachemgrRegister("url_rewriter", "URL Rewriter Stats", redirectStats, 0, 1); init = 1; CBDATA_INIT_TYPE(redirectStateData); } }
void refreshCheckInit(void) { static int firstTimeInit = 1; refresh_check_helper *p = Config.Program.refresh_check; if (p) { if (!p->helper) p->helper = helperCreate("external_refresh_check"); p->helper->cmdline = p->cmdline; p->helper->n_to_start = p->children; p->helper->concurrency = p->concurrency; p->helper->ipc_type = IPC_STREAM; helperOpenServers(p->helper); if (firstTimeInit) { firstTimeInit = 0; cachemgrRegister("refresh_check", "External ACL stats", refreshCheckStats, 0, 1); } CBDATA_INIT_TYPE_FREECB(refreshCheckState, free_refreshCheckState); } }
/* Initialize helpers and the like for this auth scheme. Called AFTER parsing the * config file */ static void authBasicInit(authScheme * scheme) { static int init = 0; if (basicConfig->authenticate) { if (!basic_data_pool) basic_data_pool = memPoolCreate("Basic Scheme User Data", sizeof(basic_data)); authbasic_initialised = 1; if (basicauthenticators == NULL) basicauthenticators = helperCreate("basicauthenticator"); basicauthenticators->cmdline = basicConfig->authenticate; basicauthenticators->n_to_start = basicConfig->authenticateChildren; basicauthenticators->concurrency = basicConfig->authenticateConcurrency; basicauthenticators->ipc_type = IPC_STREAM; helperOpenServers(basicauthenticators); if (!init) { cachemgrRegister("basicauthenticator", "Basic User Authenticator Stats", authenticateBasicStats, 0, 1); init++; } CBDATA_INIT_TYPE(authenticateStateData); } }
void externalAclInit(void) { static int firstTimeInit = 1; external_acl *p; for (p = Config.externalAclHelperList; p; p = p->next) { if (!p->cache) p->cache = hash_create((HASHCMP *) strcmp, hashPrime(1024), hash4); if (!p->helper) p->helper = helperCreate(p->name); p->helper->cmdline = p->cmdline; p->helper->n_to_start = p->children; p->helper->ipc_type = IPC_TCP_SOCKET; helperOpenServers(p->helper); } if (firstTimeInit) { firstTimeInit = 0; cachemgrRegister("external_acl", "External ACL stats", externalAclStats, 0, 1); CBDATA_INIT_TYPE_FREECB(externalAclState, free_externalAclState); } }
/* Initialize helpers and the like for this auth scheme. Called AFTER parsing the * config file */ static void authDigestInit(authScheme * scheme) { static int init = 0; if (digestConfig->authenticate) { authDigestUserSetup(); authDigestRequestSetup(); authenticateDigestNonceSetup(); authdigest_initialised = 1; if (digestauthenticators == NULL) digestauthenticators = helperCreate("digestauthenticator"); digestauthenticators->cmdline = digestConfig->authenticate; digestauthenticators->n_to_start = digestConfig->authenticateChildren; digestauthenticators->ipc_type = IPC_TCP_SOCKET; helperOpenServers(digestauthenticators); if (!init) { cachemgrRegister("digestauthenticator", "Digest User Authenticator Stats", authenticateDigestStats, 0, 1); init++; } CBDATA_INIT_TYPE(authenticateStateData); } }