sample-request.c revision 431a83fb29482c5170b3e4026e59bb14849a6707
/*
* Copyright (C) 2009, 2012-2014 Internet Systems Consortium, Inc. ("ISC")
*
* 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 ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC 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.
*/
/* $Id: sample-request.c,v 1.5 2009/09/29 15:06:07 fdupont Exp $ */
#include <config.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.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;
/* 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", optarg);
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 */
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);
}