name_test.c revision ec5347e2c775f027573ce5648b910361aa926c01
/*
* Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1998-2001, 2003 Internet Software Consortium.
*
* 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: name_test.c,v 1.40 2007/06/18 23:47:26 tbox Exp $ */
#include <config.h>
#include <stdlib.h>
#include <isc/commandline.h>
#include <dns/fixedname.h>
static void
printf("<empty wire name>\n");
return;
}
printf("\n");
}
static void
isc_region_t r;
char s[1000];
isc_buffer_init(&source, s, sizeof(s));
if (dns_name_countlabels(name) > 0)
else
if (result == ISC_R_SUCCESS) {
isc_buffer_usedregion(&source, &r);
if (r.length > 0)
else
printf("<empty text name>\n");
} else
}
int
char s[1000];
isc_region_t r;
unsigned int labels, split_label = 0;
int ch;
switch (ch) {
case 'a':
break;
case 'c':
break;
case 'd':
break;
case 'i':
break;
case 'q':
break;
case 's':
break;
case 'w':
break;
}
}
if (argc > 0) {
else {
NULL);
if (result != 0) {
"dns_name_fromtext() failed: %d\n",
result);
exit(1);
}
}
} else if (concatenate)
else
if (argc >= 1) {
else {
if (result != 0) {
"dns_name_fromtext() failed: %d\n",
result);
exit(1);
}
}
} else
len--;
}
if (len > 0U)
else {
else
}
if (result != ISC_R_SUCCESS) {
else
continue;
}
if (dns_name_isabsolute(name))
printf("absolute\n");
else
printf("relative\n");
}
if (dns_name_iswildcard(name))
printf("wildcard\n");
else
printf("not wildcard\n");
}
dns_name_toregion(name, &r);
if (!quiet) {
print_wirename(&r);
printf("%u labels, %u bytes.\n",
}
if (concatenate) {
if (got_name) {
printf("Concatenating.\n");
NULL);
if (result == ISC_R_SUCCESS) {
if (check_absolute &&
dns_name_countlabels(name) > 0) {
if (dns_name_isabsolute(name))
printf("absolute\n");
else
printf("relative\n");
}
if (check_wildcard &&
dns_name_countlabels(name) > 0) {
if (dns_name_iswildcard(name))
printf("wildcard\n");
else
printf("not "
"wildcard\n");
}
dns_name_toregion(name, &r);
if (!quiet) {
print_wirename(&r);
printf("%u labels, "
"%u bytes.\n",
r.length);
}
} else
printf("%s\n",
} else
}
isc_buffer_init(&source, s, sizeof(s));
if (dns_name_countlabels(name) > 0)
else
if (result == ISC_R_SUCCESS) {
isc_buffer_usedregion(&source, &r);
if (r.length > 0)
else
printf("<empty text name>\n");
if (!quiet) {
}
} else
if (test_downcase) {
if (inplace) {
} else {
}
if (!quiet) {
dns_name_toregion(down, &r);
print_wirename(&r);
printf("%u labels, %u bytes.\n",
r.length);
}
isc_buffer_init(&source, s, sizeof(s));
}
int order;
unsigned int nlabels;
&nlabels);
if (!quiet) {
if (order < 0)
printf("<");
else if (order > 0)
printf(">");
else
printf("=");
switch (namereln) {
case dns_namereln_contains:
printf(", contains");
break;
case dns_namereln_subdomain:
printf(", subdomain");
break;
printf(", common ancestor");
break;
default:
break;
}
if (namereln != dns_namereln_none &&
printf("\n");
}
printf("dns_name_equal() returns %s\n",
}
printf("\n prefix = ");
printf(" suffix = ");
}
if (concatenate) {
if (got_name)
else
}
}
return (0);
}