sample-request.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 2009, 2012-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-request.c,v 1.5 2009/09/29 15:06:07 fdupont Exp $ */
#include <config.h>
#ifndef WIN32
#include <netdb.h>
#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/keyvalues.h>
#include <dns/masterdump.h>
#include <dns/rdataset.h>
#include <dns/rdatastruct.h>
#include <dns/rdatatype.h>
static dns_fixedname_t fixedqname;
ISC_PLATFORM_NORETURN_PRE static void
usage(void) ISC_PLATFORM_NORETURN_POST;
static void
usage(void) {
exit(1);
}
static isc_result_t
{
isc_buffer_t b;
unsigned int namelen;
/* Construct qname */
isc_buffer_add(&b, namelen);
if (result != ISC_R_SUCCESS) {
return (result);
}
/* Construct query message */
if (result != ISC_R_SUCCESS)
goto cleanup;
if (result != ISC_R_SUCCESS)
goto cleanup;
return (ISC_R_SUCCESS);
return (result);
}
static void
isc_region_t r;
&dns_master_style_full, 0, buf);
if (result != ISC_R_SUCCESS)
goto fail;
isc_buffer_usedregion(buf, &r);
return;
fail:
}
int
switch (ch) {
case 't':
if (result != ISC_R_SUCCESS) {
"invalid RRtype: %s\n",
exit(1);
}
break;
default:
usage();
}
}
if (argc < 2)
usage();
result = dns_lib_init();
if (result != ISC_R_SUCCESS) {
exit(1);
}
if (result != ISC_R_SUCCESS) {
exit(1);
}
/* Prepare message structures */
if (result != ISC_R_SUCCESS) {
exit(1);
}
if (result == ISC_R_SUCCESS) {
&rmessage);
}
if (result != ISC_R_SUCCESS) {
exit(1);
}
/* Initialize the nameserver address */
#ifdef AI_NUMERICHOST
#endif
if (gai_error != 0) {
exit(1);
}
/* Construct qname */
if (result != ISC_R_SUCCESS) {
exit(1);
}
/* Send request and wait for a response */
if (result != ISC_R_SUCCESS) {
}
/* Dump the response */
if (result != ISC_R_SUCCESS) {
exit(1);
}
for (i = 0; i < DNS_SECTION_MAX; i++) {
}
/* Cleanup */
return (0);
}