server.c revision 936f1c128fbfd3b69acca949eae0692d3d918439
/*
* Copyright (C) 1999 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <stdarg.h>
#include <isc/assertions.h>
#include <dns/confparser.h>
#include <dns/fixedname.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/compress.h>
typedef struct {
} ns_load_t;
static isc_task_t * server_task;
static dns_view_t * version_view;
static isc_result_t
dns_view_t **viewp)
{
/*
* View.
*/
if (result != ISC_R_SUCCESS)
return (result);
/*
* Cache.
*/
if (result != ISC_R_SUCCESS)
goto cleanup;
dns_db_detach(&db);
/*
* Resolver.
*
* XXXRTH hardwired number of tasks. Also, we'll need to
* see if we are dealing with a shared dispatcher in this view.
*/
NULL);
if (result != ISC_R_SUCCESS)
goto cleanup;
/*
* We have default hints for class IN.
*/
if (rdclass == dns_rdataclass_in)
return (ISC_R_SUCCESS);
return (result);
}
static isc_result_t
void *uap)
{
/*
* Load (or reload) a zone.
*/
/*
* Find the view.
*/
if (result != ISC_R_SUCCESS)
return (result);
} else {
if (result == ISC_R_NOTFOUND) {
/*
* Create a default view.
*/
&tview);
if (result != ISC_R_SUCCESS)
return (result);
} else if (result != ISC_R_SUCCESS)
return (result);
}
/*
* Do we already have a production version of this view?
*/
&pview);
goto cleanup;
/*
* Create a new zone structure and configure it.
*/
if (result != ISC_R_SUCCESS)
return (result);
if (result != ISC_R_SUCCESS)
return (result);
INSIST(0);
} else {
/*
* Check for duplicates in the new zone table.
*/
if (result == ISC_R_SUCCESS) {
/*
* We already have this zone!
*/
goto cleanup;
}
/*
* Do we have the zone in the production view?
*/
else
if (result == ISC_R_SUCCESS) {
/*
* Yes.
*
* If the production zone's configuration is
* the same as the new zone's, we can use the
* production zone.
*/
} else
} else if (result == ISC_R_NOTFOUND) {
/*
* This is a new zone.
*/
}
}
if (need_load) {
/*
* XXXRTH What should we do about errors? We don't
* want to fail the whole config file load just
* because we couldn't get a zone.
*/
if (result != ISC_R_SUCCESS) {
}
}
return (result);
}
static void
load_configuration(const char *filename) {
&callbacks);
if (result != ISC_R_SUCCESS) {
#ifdef notyet
}
#endif
"load of '%s' failed", filename);
}
/*
* XXXRTH Create default view, if required.
*/
/*
* Freeze the views.
*/
/*
* Attach the version view.
*/
/*
* Load zones. (???)
*/
#ifdef notyet
}
#endif
/*
* Put the configuration into production.
*/
/*
* Cleanup old configuration.
*/
}
if (oconfigctx != NULL)
}
static void
(void)task;
ISC_LOG_INFO, "running");
}
static isc_result_t
create_version_view(void) {
char version_text[1024];
&view);
if (result != ISC_R_SUCCESS)
return (result);
if (result != ISC_R_SUCCESS)
goto cleanup;
if (result != ISC_R_SUCCESS)
goto cleanup;
if (result != ISC_R_SUCCESS)
goto cleanup;
if (result != DNS_R_SUCCESS)
return (result);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS)
goto cleanup;
if (result != DNS_R_SUCCESS)
goto cleanup;
if (result != DNS_R_SUCCESS)
goto cleanup;
version_view = view;
dns_db_detach(&db);
return (result);
}
static void
(void)task;
ISC_LOG_INFO, "shutting down");
}
/*
* XXXRTH Is this the right place to do this?
*/
}
ns_server_init(void) {
/*
* Setup default root server hints.
*/
result = ns_rootns_init();
if (result != ISC_R_SUCCESS)
return (result);
if (result != ISC_R_SUCCESS)
return (result);
0, &ns_g_zonetasks);
if (result != ISC_R_SUCCESS)
return (result);
/*
* Setup the server task, which is responsible for coordinating
* startup and shutdown of the server.
*/
if (result != ISC_R_SUCCESS)
goto cleanup_rootns;
if (result != ISC_R_SUCCESS)
goto cleanup_task;
if (result != ISC_R_SUCCESS)
goto cleanup_task;
return (ISC_R_SUCCESS);
/* XXXRTH Add taskpool, and version view cleanups. */
return (result);
}
void
const char *format, ...)
{
ISC_LOG_CRITICAL, "exiting (due to fatal error)");
if (want_core && ns_g_coreok)
abort();
exit(1);
}