server.c revision 92583b722bfdcc5714dfd77711c54fee55f51c5d
b54630c4518a1a173fee3478f4bf51dff450b6dcMark Andrews * Copyright (C) 1999 Internet Software Consortium.
b54630c4518a1a173fee3478f4bf51dff450b6dcMark Andrews * Permission to use, copy, modify, and distribute this software for any
b54630c4518a1a173fee3478f4bf51dff450b6dcMark Andrews * purpose with or without fee is hereby granted, provided that the above
b54630c4518a1a173fee3478f4bf51dff450b6dcMark Andrews * copyright notice and this permission notice appear in all copies.
b54630c4518a1a173fee3478f4bf51dff450b6dcMark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
b54630c4518a1a173fee3478f4bf51dff450b6dcMark Andrews * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
b54630c4518a1a173fee3478f4bf51dff450b6dcMark Andrews * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
b54630c4518a1a173fee3478f4bf51dff450b6dcMark Andrews * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
b54630c4518a1a173fee3478f4bf51dff450b6dcMark Andrews * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
b54630c4518a1a173fee3478f4bf51dff450b6dcMark Andrews * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
b54630c4518a1a173fee3478f4bf51dff450b6dcMark Andrews * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
ca9739800f045cd4d39014f98b920d4354b5bd14Michael Graff * XXXRTH View list code will move to its own module soon.
78da321b437bbb690ef570ccf17dcc8583a5a4a0Mark Andrews isc_buffer_init(&source, dbi->origin, len, ISC_BUFFERTYPE_TEXT);
b54630c4518a1a173fee3478f4bf51dff450b6dcMark Andrews result = dns_name_fromtext(origin, &source, dns_rootname, ISC_FALSE,
78da321b437bbb690ef570ccf17dcc8583a5a4a0Mark Andrews result = dns_db_create(ns_g_mctx, "rbt", origin, dbi->iscache,
59abb512d344bfa09012cc11b7d814966f035da4Mark Andrews printf("loading %s (%s)\n", dbi->path, dbi->origin);
78da321b437bbb690ef570ccf17dcc8583a5a4a0Mark Andrews /* Ignore the error, just leave dbi->db == NULL. */
78da321b437bbb690ef570ccf17dcc8583a5a4a0Mark Andrews result = dns_journal_rollforward(ns_g_mctx, dbi->db, "journal");
46993e1d9d18410a5852b7d990338b70b158855cMichael Graff "ns_rollforward(): %s",
78da321b437bbb690ef570ccf17dcc8583a5a4a0Mark Andrews /* Continue anyway... */
34ee961fa2f0f5f2ee3cff40fdb4d7d7b48b7728Mark Andrews else if (dns_view_addzonedb(view, dbi->db) != DNS_R_SUCCESS)
b54630c4518a1a173fee3478f4bf51dff450b6dcMark Andrews sprintf(version_text, "version 0 CHAOS TXT \"%s\"\n", ns_g_version);
440164d3e36353a4b9801fcc05fe66b6cf1fb8ceMark Andrews * XXXRTH View list code will move to its own module soon.
a5c30de2601a1d130a15a78cf3dc7610a02b2d85Mark Andrews if (strcasecmp(view->name, "default/CHAOS") == 0) {
46993e1d9d18410a5852b7d990338b70b158855cMichael Graff RWUNLOCK(&ns_g_viewlock, isc_rwlocktype_read);
b54630c4518a1a173fee3478f4bf51dff450b6dcMark Andrews isc_buffer_init(&source, "bind.", len, ISC_BUFFERTYPE_TEXT);
a5c30de2601a1d130a15a78cf3dc7610a02b2d85Mark Andrews result = dns_name_fromtext(origin, &source, dns_rootname, ISC_FALSE,
440164d3e36353a4b9801fcc05fe66b6cf1fb8ceMark Andrews result = dns_db_create(ns_g_mctx, "rbt", origin, ISC_FALSE,
b54630c4518a1a173fee3478f4bf51dff450b6dcMark Andrews isc_buffer_init(&source, version_text, len, ISC_BUFFERTYPE_TEXT);
b54630c4518a1a173fee3478f4bf51dff450b6dcMark Andrews result = dns_db_beginload(version_db, &callbacks.add,
b54630c4518a1a173fee3478f4bf51dff450b6dcMark Andrews result = dns_master_loadbuffer(&source, &version_db->origin,
b54630c4518a1a173fee3478f4bf51dff450b6dcMark Andrews eresult = dns_db_endload(version_db, &callbacks.add_private);
b54630c4518a1a173fee3478f4bf51dff450b6dcMark Andrews if (dns_view_addzonedb(version_view, version_db) != DNS_R_SUCCESS)
a5c30de2601a1d130a15a78cf3dc7610a02b2d85Mark Andrews for (dbi = ISC_LIST_HEAD(ns_g_dbs); dbi != NULL; dbi = dbi_next) {
a5c30de2601a1d130a15a78cf3dc7610a02b2d85Mark Andrews * XXXRTH loading code below is temporary; it
a5c30de2601a1d130a15a78cf3dc7610a02b2d85Mark Andrews * will be replaced by proper config file processing.
a5c30de2601a1d130a15a78cf3dc7610a02b2d85Mark Andrews /* XXXRTH */
8b61d2012063306528286680bd9f086fa868d86eMark Andrews printf("load_all(): %s\n", isc_result_totext(result));
4be19dcd14cea678511f1d1b269ab89273e987eeMark Andrewsrun_server(isc_task_t *task, isc_event_t *event) {
b54630c4518a1a173fee3478f4bf51dff450b6dcMark Andrewsshutdown_server(isc_task_t *task, isc_event_t *event) {
b54630c4518a1a173fee3478f4bf51dff450b6dcMark Andrews RWUNLOCK(&ns_g_viewlock, isc_rwlocktype_write);
b54630c4518a1a173fee3478f4bf51dff450b6dcMark Andrews * XXXRTH The view management code here will probably move to its
34ee961fa2f0f5f2ee3cff40fdb4d7d7b48b7728Mark Andrews * own module when we start using the config file.
78da321b437bbb690ef570ccf17dcc8583a5a4a0Mark Andrews result = dns_view_create(ns_g_mctx, dns_rdataclass_in, "default/IN",
b54630c4518a1a173fee3478f4bf51dff450b6dcMark Andrews result = dns_view_create(ns_g_mctx, dns_rdataclass_ch, "default/CHAOS",
b54630c4518a1a173fee3478f4bf51dff450b6dcMark Andrews result = isc_task_create(ns_g_taskmgr, ns_g_mctx, 0, &server_task);
b54630c4518a1a173fee3478f4bf51dff450b6dcMark Andrews result = isc_task_onshutdown(server_task, shutdown_server, NULL);