/*
* Copyright (C) 2009, 2013-2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $Id: sample-async.c,v 1.5 2009/09/29 15:06:07 fdupont Exp $ */
#include <config.h>
#ifndef WIN32
#include <unistd.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <isc/commandline.h>
#include <isc/sockaddr.h>
#include <dns/fixedname.h>
#include <dns/rdataset.h>
#include <dns/rdatatype.h>
static unsigned int outstanding_queries = 0;
struct query_trans {
int id;
};
static void
{
if (*socketmgrp != NULL)
}
static isc_result_t
{
if (result != ISC_R_SUCCESS)
goto fail;
if (result != ISC_R_SUCCESS)
goto fail;
if (result != ISC_R_SUCCESS)
goto fail;
if (result != ISC_R_SUCCESS)
goto fail;
if (result != ISC_R_SUCCESS)
goto fail;
return (ISC_R_SUCCESS);
fail:
return (result);
}
static isc_result_t
isc_region_t r;
char t[4096];
isc_buffer_init(&target, t, sizeof(t));
return (ISC_R_SUCCESS);
&target);
if (result != ISC_R_SUCCESS)
return (result);
isc_buffer_usedregion(&target, &r);
return (ISC_R_SUCCESS);
}
static void
REQUIRE(outstanding_queries > 0);
}
}
#if 0 /* for cancel test */
if (result == ISC_R_SUCCESS) {
static int count = 0;
if ((++count) % 10 == 0)
}
#endif
}
static isc_result_t
unsigned int namelen;
isc_buffer_t b;
char *cp;
/* Construct qname */
return (ISC_R_NOMORE);
/* zap NL if any */
*cp = '\0';
isc_buffer_add(&b, namelen);
if (result != ISC_R_SUCCESS)
goto cleanup;
/* Start resolution */
if (result != ISC_R_SUCCESS)
goto cleanup;
return (ISC_R_SUCCESS);
return (result);
}
ISC_PLATFORM_NORETURN_PRE static void
usage(void) ISC_PLATFORM_NORETURN_POST;
static void
usage(void) {
"input_file\n");
exit(1);
}
int
int ch;
int nservers = 0;
int i;
switch (ch) {
case 't':
if (result != ISC_R_SUCCESS) {
"invalid RRtype: %s\n",
exit(1);
}
break;
case 's':
if (nservers == MAX_SERVERS) {
"too many servers (up to %d)\n",
exit(1);
}
serveraddr[nservers++] =
(const char *)isc_commandline_argument;
break;
default:
usage();
}
}
if (argc < 1)
usage();
if (nservers == 0) {
nservers = 1;
serveraddr[0] = def_server;
}
for (i = 0; i < MAX_QUERIES; i++) {
query_array[i].id = i;
}
result = dns_lib_init();
if (result != ISC_R_SUCCESS) {
exit(1);
}
&timermgr);
if (result != ISC_R_SUCCESS) {
exit(1);
}
if (result != ISC_R_SUCCESS) {
exit(1);
}
/* Set nameservers */
for (i = 0; i < nservers; i++) {
serveraddr[i]);
exit(1);
}
}
&servers);
if (result != ISC_R_SUCCESS) {
exit(1);
}
/* Create the main task */
query_task = NULL;
if (result != ISC_R_SUCCESS) {
exit(1);
}
/* Open input file */
exit(1);
}
/* Dispatch initial queries */
for (i = 0; i < MAX_QUERIES; i++) {
if (result == ISC_R_NOMORE)
break;
}
/* Start event loop */
/* Sanity check */
for (i = 0; i < MAX_QUERIES; i++)
/* Cleanup */
return (0);
}