server.c revision 72fb946eb082b1ae161c7b14f9f3d26fbd1c3caf
/*
* 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>
#include "confparser.h"
#include "udpclient.h"
#include "tcpclient.h"
typedef struct dbinfo {
} dbinfo;
static char dbtype[128];
static dns_dbtable_t * dbtable;
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;
/*
* XXX This is a total and disgusting hack. We need a way to add
* a copy of a rdataset and a name to the new message, but for now
* I'll just steal the one from the existing query message, and
* make certain the query is not destroyed before our message is.
*/
if (result != DNS_R_SUCCESS)
return (result);
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);
}
static dns_result_t
return (DNS_R_NOMEMORY);
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");
if (cache) {
} else {
return (result);
}
}
return (DNS_R_SUCCESS);
}
static void
unload_all(void) {
else {
}
}
}
int
{
unsigned int workers;
unsigned int addrlen;
int ch;
char *origintext;
#if 0 /* brister */
#endif
/*+ XXX */
switch (ch) {
case 'c':
if (result != DNS_R_SUCCESS)
break;
case 'd':
break;
case 'z':
if (origintext == NULL)
origintext = optarg;
else
origintext++; /* Skip '/'. */
if (result != DNS_R_SUCCESS)
break;
case 's':
break;
}
}
if (argc > 1)
/*- XXX */
addrlen = sizeof(struct sockaddr_in);
workers = 2;
#if 0 /* brister */
parser_init();
#endif
/*
* open up a UDP socket
*/
addrlen = sizeof(struct sockaddr_in);
(int)addrlen) == ISC_R_SUCCESS);
dispatch) == ISC_R_SUCCESS);
if (want_stats)
/*
* open up a TCP socket
*/
addrlen = sizeof(struct sockaddr_in);
(int)addrlen) == ISC_R_SUCCESS);
dispatch) == ISC_R_SUCCESS);
if (want_stats)
/*
* XXX Need to set up a condition variable here, and wait on it.
* For now, just semi-busy loop.
*/
for (;;)
sleep(10);
unload_all();
printf("Destroying socket manager\n");
printf("Destroying task manager\n");
if (want_stats)
return (0);
}