rdata_test.c revision dafcb997e390efa4423883dafd100c975c4095d6
/*
* Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1998-2003 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 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: rdata_test.c,v 1.41 2004/03/05 04:58:39 marka Exp $ */
#include <config.h>
#include <stdlib.h>
#include <isc/commandline.h>
#include <dns/compress.h>
#include <dns/rdataclass.h>
#include <dns/rdatastruct.h>
#include <dns/rdatatype.h>
static void
{
UNUSED(b);
case dns_rdatatype_a6: {
break;
}
case dns_rdatatype_a: {
case dns_rdataclass_hs: {
break;
}
case dns_rdataclass_in: {
break;
}
default:
break;
}
break;
}
case dns_rdatatype_aaaa: {
break;
}
case dns_rdatatype_afsdb: {
break;
}
case dns_rdatatype_any: {
break;
}
case dns_rdatatype_apl: {
case dns_rdataclass_in: {
break;
}
default:
break;
}
break;
}
case dns_rdatatype_cert: {
break;
}
case dns_rdatatype_cname: {
break;
}
case dns_rdatatype_dname: {
break;
}
case dns_rdatatype_gpos: {
break;
}
case dns_rdatatype_hinfo: {
break;
}
case dns_rdatatype_isdn: {
break;
}
case dns_rdatatype_key: {
break;
}
case dns_rdatatype_kx: {
break;
}
case dns_rdatatype_loc: {
break;
}
case dns_rdatatype_mb: {
break;
}
case dns_rdatatype_md: {
break;
}
case dns_rdatatype_mf: {
break;
}
case dns_rdatatype_mg: {
break;
}
case dns_rdatatype_minfo: {
break;
}
case dns_rdatatype_mr: {
break;
}
case dns_rdatatype_mx: {
break;
}
case dns_rdatatype_naptr: {
break;
}
case dns_rdatatype_ns: {
break;
}
case dns_rdatatype_nsap: {
break;
}
case dns_rdatatype_nsap_ptr: {
break;
}
case dns_rdatatype_null: {
break;
}
case dns_rdatatype_nxt: {
break;
}
case dns_rdatatype_opt: {
break;
}
case dns_rdatatype_ptr: {
break;
}
case dns_rdatatype_px: {
break;
}
case dns_rdatatype_rp: {
break;
}
case dns_rdatatype_rt: {
break;
}
case dns_rdatatype_sig: {
break;
}
case dns_rdatatype_soa: {
break;
}
case dns_rdatatype_srv: {
break;
}
case dns_rdatatype_tkey: {
break;
}
case dns_rdatatype_tsig: {
break;
}
case dns_rdatatype_txt: {
break;
}
case dns_rdatatype_unspec: {
break;
}
case dns_rdatatype_wks: {
break;
}
case dns_rdatatype_x25: {
break;
}
case dns_rdatatype_nsec: {
break;
}
case dns_rdatatype_rrsig: {
break;
}
case dns_rdatatype_dnskey: {
break;
}
default:
break;
}
if (result != ISC_R_SUCCESS)
else
case dns_rdatatype_a6: {
break;
}
case dns_rdatatype_a: {
case dns_rdataclass_hs: {
break;
}
case dns_rdataclass_in: {
break;
}
default:
break;
}
break;
}
case dns_rdatatype_aaaa: {
break;
}
case dns_rdatatype_afsdb: {
break;
}
case dns_rdatatype_any: {
break;
}
case dns_rdatatype_apl: {
case dns_rdataclass_in: {
break;
}
default:
break;
}
break;
}
case dns_rdatatype_cert: {
break;
}
case dns_rdatatype_cname: {
break;
}
case dns_rdatatype_dname: {
break;
}
case dns_rdatatype_gpos: {
break;
}
case dns_rdatatype_hinfo: {
break;
}
case dns_rdatatype_isdn: {
break;
}
case dns_rdatatype_key: {
break;
}
case dns_rdatatype_kx: {
break;
}
case dns_rdatatype_loc: {
break;
}
case dns_rdatatype_mb: {
break;
}
case dns_rdatatype_md: {
break;
}
case dns_rdatatype_mf: {
break;
}
case dns_rdatatype_mg: {
break;
}
case dns_rdatatype_minfo: {
break;
}
case dns_rdatatype_mr: {
break;
}
case dns_rdatatype_mx: {
break;
}
case dns_rdatatype_naptr: {
break;
}
case dns_rdatatype_ns: {
break;
}
case dns_rdatatype_nsap: {
break;
}
case dns_rdatatype_nsap_ptr: {
break;
}
case dns_rdatatype_null: {
break;
}
case dns_rdatatype_nxt: {
break;
}
case dns_rdatatype_opt: {
break;
}
case dns_rdatatype_ptr: {
break;
}
case dns_rdatatype_px: {
break;
}
case dns_rdatatype_rp: {
break;
}
case dns_rdatatype_rt: {
break;
}
case dns_rdatatype_sig: {
break;
}
case dns_rdatatype_soa: {
break;
}
case dns_rdatatype_srv: {
break;
}
case dns_rdatatype_tkey: {
break;
}
case dns_rdatatype_tsig: {
break;
}
case dns_rdatatype_txt: {
break;
}
case dns_rdatatype_unspec: {
break;
}
case dns_rdatatype_wks: {
break;
}
case dns_rdatatype_x25: {
break;
}
case dns_rdatatype_nsec: {
break;
}
case dns_rdatatype_rrsig: {
break;
}
case dns_rdatatype_dnskey: {
break;
}
default:
break;
}
if (result != ISC_R_SUCCESS)
else {
if (result != ISC_R_SUCCESS)
"viastruct: fromstuct %d %d return %s\n",
{
isc_uint32_t i;
isc_uint32_t l;
for (i = 0; i < l; i++)
}
}
#if 0
case dns_rdatatype_a6: {
break;
}
case dns_rdatatype_a: {
case dns_rdataclass_hs: {
&hs_a, b);
break;
}
case dns_rdataclass_in: {
&in_a, b);
break;
}
default:
break;
}
break;
}
case dns_rdatatype_aaaa: {
break;
}
case dns_rdatatype_afsdb: {
break;
}
case dns_rdatatype_any: {
break;
}
case dns_rdatatype_apl: {
case dns_rdataclass_in: {
break;
}
default:
break;
}
break;
}
case dns_rdatatype_cert: {
break;
}
case dns_rdatatype_cname: {
break;
}
case dns_rdatatype_dname: {
break;
}
case dns_rdatatype_gpos: {
break;
}
case dns_rdatatype_hinfo: {
break;
}
case dns_rdatatype_isdn: {
break;
}
case dns_rdatatype_key: {
break;
}
case dns_rdatatype_kx: {
break;
}
case dns_rdatatype_loc: {
break;
}
case dns_rdatatype_mb: {
break;
}
case dns_rdatatype_md: {
break;
}
case dns_rdatatype_mf: {
break;
}
case dns_rdatatype_mg: {
break;
}
case dns_rdatatype_minfo: {
break;
}
case dns_rdatatype_mr: {
break;
}
case dns_rdatatype_mx: {
break;
}
case dns_rdatatype_naptr: {
break;
}
case dns_rdatatype_ns: {
break;
}
case dns_rdatatype_nsap: {
break;
}
case dns_rdatatype_nsap_ptr: {
b);
break;
}
case dns_rdatatype_null: {
break;
}
case dns_rdatatype_nxt: {
break;
}
case dns_rdatatype_opt: {
break;
}
case dns_rdatatype_ptr: {
break;
}
case dns_rdatatype_px: {
break;
}
case dns_rdatatype_rp: {
break;
}
case dns_rdatatype_rt: {
break;
}
case dns_rdatatype_sig: {
break;
}
case dns_rdatatype_soa: {
break;
}
case dns_rdatatype_srv: {
break;
}
case dns_rdatatype_tkey: {
break;
}
case dns_rdatatype_tsig: {
break;
}
case dns_rdatatype_txt: {
break;
}
case dns_rdatatype_unspec: {
break;
}
case dns_rdatatype_wks: {
break;
}
case dns_rdatatype_x25: {
break;
}
case dns_rdatatype_nsec: {
break;
}
case dns_rdatatype_rrsig: {
break;
}
case dns_rdatatype_dnskey: {
break;
}
default:
break;
}
#endif
if (need_free)
}
int
int quiet = 0;
int c;
int stats = 0;
unsigned int options = 0;
dns_rdatatype_t lasttype = 0;
int need_eol = 0;
int wire = 0;
int trunc = 0;
int add = 0;
int len;
int zero = 0;
int debug = 0;
int first = 1;
int raw = 0;
int tostruct = 0;
switch (c) {
case 'd':
debug = 1;
quiet = 0;
break;
case 'q':
quiet = 1;
debug = 0;
break;
case 's':
stats = 1;
break;
case 'w':
wire = 1;
break;
case 't':
trunc = 1;
break;
case 'a':
add = 1;
break;
case 'z':
zero = 1;
break;
case 'r':
raw++;
break;
case 'S':
tostruct++;
break;
}
}
/*
* Set up to lex DNS master file.
*/
&token)) == ISC_R_SUCCESS) {
if (need_eol) {
need_eol = 0;
continue;
}
break;
/*
* Get type.
*/
if (result != ISC_R_SUCCESS) {
"dns_rdatatype_fromtext "
"returned %s(%d)\n",
need_eol = 1;
continue;
}
} else
continue;
&token);
if (result != ISC_R_SUCCESS)
break;
continue;
break;
if (result != ISC_R_SUCCESS) {
"returned %s(%d)\n",
need_eol = 1;
continue;
}
} else
continue;
NULL);
if (result != ISC_R_SUCCESS) {
"dns_rdata_fromtext returned %s(%d)\n",
continue;
}
if (raw) {
unsigned int i;
if ((++i % 20) == 0)
else
else
}
}
/*
* Convert to wire and back?
*/
if (wire) {
if (result != ISC_R_SUCCESS) {
"dns_compress_init returned %s(%d)\n",
continue;
}
if (result != ISC_R_SUCCESS) {
"dns_rdata_towire returned %s(%d)\n",
continue;
}
if (raw > 2) {
unsigned int i;
for (i = 0; i < (unsigned int)len; /* */ ) {
if ((++i % 20) == 0)
else
else
}
}
if (zero)
len = 0;
if (trunc)
if (add) {
}
if (result != ISC_R_SUCCESS) {
"dns_rdata_fromwire returned %s(%d)\n",
continue;
}
}
if (raw > 1) {
unsigned int i;
if ((++i % 20) == 0)
else
else
}
}
if (tostruct) {
== ISC_R_SUCCESS);
}
if (result != ISC_R_SUCCESS)
else
}
if (!first) {
}
first = 0;
} else
first = 1;
}
return (0);
}