server.c revision 533b0475054882ea1c81cb1ec4aa3e6750711bbc
/*
* 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 <isc/assertions.h>
#include <dns/fixedname.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/compress.h>
#if 0
#include "udpclient.h"
#include "tcpclient.h"
#include "interfacemgr.h"
#endif
static dns_dbtable_t * dbtable;
static ns_dbinfo_t * cache_dbi;
static isc_task_t * server_task;
#if 0
static inline isc_boolean_t
{
if ((result) != DNS_R_SUCCESS) {
return (ISC_TRUE);
}
return (ISC_FALSE);
}
/*
* This is in bin/tests/wire_test.c, but should be in a debugging library.
*/
extern dns_result_t
#define MAX_RDATASETS 25
static dns_result_t
unsigned int nrdatasets = 0;
if (result != DNS_R_SUCCESS)
return (result);
if (result != DNS_R_SUCCESS)
return (DNS_R_UNEXPECTED);
return (DNS_R_UNEXPECTED);
/*
* Find a database to answer the query from.
*/
printf("could not find a dbtable: %s\n",
goto render;
}
/*
* Now look for an answer in the database.
*/
rdataset);
switch (dbresult) {
case DNS_R_SUCCESS:
case DNS_R_DNAME:
case DNS_R_CNAME:
break;
case DNS_R_GLUE:
case DNS_R_ZONECUT:
case DNS_R_DELEGATION:
break;
case DNS_R_NXRDATASET:
if (dns_db_iszone(db))
dns_db_detach(&db);
goto render;
case DNS_R_NXDOMAIN:
if (dns_db_iszone(db))
dns_db_detach(&db);
goto render;
default:
dns_db_detach(&db);
goto render;
}
if (dbresult == DNS_R_DELEGATION) {
} else if (type == dns_rdatatype_any) {
if (result == DNS_R_SUCCESS)
while (result == DNS_R_SUCCESS) {
if (nrdatasets == MAX_RDATASETS) {
} else {
}
}
if (result != DNS_R_NOMORE) {
dns_db_detach(&db);
goto render;
}
} else {
}
dns_db_detach(&db);
if (result != DNS_R_SUCCESS)
return (result);
0, 0);
if (result != DNS_R_SUCCESS)
return (result);
0, 0);
if (result != DNS_R_SUCCESS)
return (result);
0, 0);
if (result != DNS_R_SUCCESS)
return (result);
0, 0);
if (result != DNS_R_SUCCESS)
return (result);
0, 0);
if (result != DNS_R_SUCCESS)
return (result);
return (DNS_R_SUCCESS);
}
/*
* Process the wire format message given in r, and return a new packet to
* transmit.
*
* Return of DNS_R_SUCCESS means r->base is a newly allocated region of
* memory, and r->length is its length. The actual for-transmit packet
* begins at (r->length + reslen) to reserve (reslen) bytes at the front
* of the packet for transmission specific details.
*/
static dns_result_t
{
char t[512];
/*
* Set up the input buffer from the contents of the region passed
* to us.
*/
return (result);
}
return (result);
}
return (result);
}
if (result != DNS_R_SUCCESS) {
return (result);
}
/*
* Copy the reply out, adjusting for reslen
*/
return (DNS_R_NOMEMORY);
}
if (want_stats)
return (DNS_R_SUCCESS);
}
#endif
static dns_result_t
NULL);
if (result != DNS_R_SUCCESS)
return (result);
if (result != DNS_R_SUCCESS) {
return (result);
}
if (result != DNS_R_SUCCESS) {
return (result);
}
printf("loaded\n");
} else {
return (result);
}
}
return (DNS_R_SUCCESS);
}
static isc_result_t
load_all(void) {
if (result != ISC_R_SUCCESS)
break;
}
return (result);
}
static void
unload_all(void) {
else {
}
}
}
static void
load_configuration(void) {
/*
* XXXRTH loading code below is temporary; it
* will be replaced by proper config file processing.
*/
if (result != ISC_R_SUCCESS) {
/* XXXRTH */
}
}
static void
(void)task;
printf("server running\n");
}
static void
(void)task;
printf("server shutting down\n");
unload_all();
}
ns_server_init(void) {
if (result != ISC_R_SUCCESS)
return (result);
if (result != ISC_R_SUCCESS)
goto cleanup_dbtable;
if (result != ISC_R_SUCCESS)
goto cleanup_task;
if (result != ISC_R_SUCCESS)
goto cleanup_task;
return (ISC_R_SUCCESS);
return (result);
}