2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00

eliminate dns_ types that duplicate isc_ types

This commit is contained in:
Bob Halley
1999-01-04 19:14:00 +00:00
parent 77e58a7e01
commit 38d2d0e932
4 changed files with 54 additions and 60 deletions

View File

@@ -50,8 +50,8 @@ main(int argc, char *argv[]) {
unsigned int tbytes; unsigned int tbytes;
dns_result_t result; dns_result_t result;
dns_name_t name, oname, compname; dns_name_t name, oname, compname;
dns_textregion_t source, ttarget; isc_textregion_t source, ttarget;
dns_region_t target, r; isc_region_t target, r;
dns_name_t *origin, *comp; dns_name_t *origin, *comp;
isc_boolean_t downcase = ISC_FALSE; isc_boolean_t downcase = ISC_FALSE;

View File

@@ -72,6 +72,8 @@
*** Imports *** Imports
***/ ***/
#include <isc/boolean.h>
#include <dns/types.h> #include <dns/types.h>
#include <dns/result.h> #include <dns/result.h>
@@ -197,7 +199,7 @@ void dns_name_init(dns_name_t *name);
*** Properties *** Properties
***/ ***/
dns_boolean_t dns_name_isabsolute(dns_name_t *name); isc_boolean_t dns_name_isabsolute(dns_name_t *name);
/* /*
* Does 'name' end in the root label? * Does 'name' end in the root label?
* *
@@ -236,7 +238,7 @@ int dns_name_compare(dns_name_t *name1, dns_name_t *name2);
* 1 'name1' is greater than 'name2' * 1 'name1' is greater than 'name2'
*/ */
dns_boolean_t isc_boolean_t
dns_name_issubdomain(dns_name_t *name1, dns_name_t *name2); dns_name_issubdomain(dns_name_t *name1, dns_name_t *name2);
/* /*
* Is 'name1' a subdomain of 'name2'? * Is 'name1' a subdomain of 'name2'?
@@ -328,7 +330,7 @@ void dns_name_getlabelsequence(dns_name_t *source,
*** Conversions *** Conversions
***/ ***/
void dns_name_fromregion(dns_name_t *name, dns_region_t *r); void dns_name_fromregion(dns_name_t *name, isc_region_t *r);
/* /*
* Make 'name' refer to region 'r'. * Make 'name' refer to region 'r'.
* *
@@ -343,7 +345,7 @@ void dns_name_fromregion(dns_name_t *name, dns_region_t *r);
* The length of 'r' is <= 255. * The length of 'r' is <= 255.
*/ */
void dns_name_toregion(dns_name_t *name, dns_region_t *r); void dns_name_toregion(dns_name_t *name, isc_region_t *r);
/* /*
* Make 'r' refer to 'name'. * Make 'r' refer to 'name'.
* *
@@ -355,10 +357,10 @@ void dns_name_toregion(dns_name_t *name, dns_region_t *r);
*/ */
dns_result_t dns_name_fromwire(dns_name_t *name, dns_result_t dns_name_fromwire(dns_name_t *name,
dns_region_t *source, isc_region_t *source,
dns_decompression_t *dctx, dns_decompression_t *dctx,
dns_boolean_t downcase, isc_boolean_t downcase,
dns_region_t *target); isc_region_t *target);
/* /*
* Copy the possibly-compressed name at source into target, decompressing it. * Copy the possibly-compressed name at source into target, decompressing it.
* *
@@ -407,7 +409,7 @@ dns_result_t dns_name_fromwire(dns_name_t *name,
dns_result_t dns_name_towire(dns_name_t *name, dns_result_t dns_name_towire(dns_name_t *name,
dns_compression_t *cctx, dns_compression_t *cctx,
dns_region_t *target, unsigned int *bytesp); isc_region_t *target, unsigned int *bytesp);
/* /*
* Convert 'name' into wire format, compressing it as specified by the * Convert 'name' into wire format, compressing it as specified by the
* compression context 'cctx', and storing the result in 'target'. * compression context 'cctx', and storing the result in 'target'.
@@ -441,10 +443,10 @@ dns_result_t dns_name_towire(dns_name_t *name,
*/ */
dns_result_t dns_name_fromtext(dns_name_t *name, dns_result_t dns_name_fromtext(dns_name_t *name,
dns_textregion_t *source, isc_textregion_t *source,
dns_name_t *origin, dns_name_t *origin,
dns_boolean_t downcase, isc_boolean_t downcase,
dns_region_t *target); isc_region_t *target);
/* /*
* Convert the textual representation of a DNS name at source * Convert the textual representation of a DNS name at source
* into uncompressed wire form stored in target. * into uncompressed wire form stored in target.
@@ -488,8 +490,8 @@ dns_result_t dns_name_fromtext(dns_name_t *name,
*/ */
dns_result_t dns_name_totext(dns_name_t *name, dns_result_t dns_name_totext(dns_name_t *name,
dns_boolean_t omit_final_dot, isc_boolean_t omit_final_dot,
dns_textregion_t *target, unsigned int *bytesp); isc_textregion_t *target, unsigned int *bytesp);
/* /*
* Convert 'name' into text format, storing the result in 'target'. * Convert 'name' into text format, storing the result in 'target'.
* *

View File

@@ -27,17 +27,9 @@
*/ */
#include <isc/region.h> #include <isc/region.h>
#include <isc/boolean.h>
#define DNS_TRUE ISC_TRUE typedef isc_region_t dns_label_t;
#define DNS_FALSE ISC_FALSE
typedef isc_boolean_t dns_boolean_t;
typedef isc_region_t dns_region_t;
typedef isc_textregion_t dns_textregion_t;
typedef dns_region_t dns_label_t;
typedef struct dns_name dns_name_t; typedef struct dns_name dns_name_t;
typedef struct dns_lex dns_lex_t;
typedef struct dns_compression dns_compression_t; typedef struct dns_compression dns_compression_t;
typedef struct dns_decompression dns_decompression_t; typedef struct dns_decompression dns_decompression_t;
typedef unsigned int dns_rdataclass_t; typedef unsigned int dns_rdataclass_t;

View File

@@ -115,7 +115,7 @@ static struct dns_name root = { "", 1, 1 };
dns_name_t *dns_rootname = &root; dns_name_t *dns_rootname = &root;
static void set_offsets(dns_name_t *, dns_boolean_t, dns_boolean_t); static void set_offsets(dns_name_t *, isc_boolean_t, isc_boolean_t);
static void compact(dns_name_t *); static void compact(dns_name_t *);
/* /*
@@ -221,7 +221,7 @@ dns_name_init(dns_name_t *name) {
name->labels = 0; name->labels = 0;
} }
dns_boolean_t isc_boolean_t
dns_name_isabsolute(dns_name_t *name) { dns_name_isabsolute(dns_name_t *name) {
/* /*
* Does 'name' end in the root label? * Does 'name' end in the root label?
@@ -230,8 +230,8 @@ dns_name_isabsolute(dns_name_t *name) {
REQUIRE(VALID_NAME(name)); REQUIRE(VALID_NAME(name));
if (name->ndata[name->offsets[name->labels - 1]] == 0) if (name->ndata[name->offsets[name->labels - 1]] == 0)
return (DNS_TRUE); return (ISC_TRUE);
return (DNS_FALSE); return (ISC_FALSE);
} }
int int
@@ -338,9 +338,9 @@ dns_name_compare(dns_name_t *name1, dns_name_t *name2) {
return (ldiff); return (ldiff);
} }
dns_boolean_t isc_boolean_t
dns_name_issubdomain(dns_name_t *name1, dns_name_t *name2) { dns_name_issubdomain(dns_name_t *name1, dns_name_t *name2) {
dns_boolean_t a1, a2; isc_boolean_t a1, a2;
unsigned int l1, l2, count1, count2; unsigned int l1, l2, count1, count2;
unsigned int b1, b2, n; unsigned int b1, b2, n;
unsigned char c1, c2; unsigned char c1, c2;
@@ -367,7 +367,7 @@ dns_name_issubdomain(dns_name_t *name1, dns_name_t *name2) {
l1 = name1->labels; l1 = name1->labels;
l2 = name2->labels; l2 = name2->labels;
if (l1 < l2) if (l1 < l2)
return (DNS_FALSE); return (ISC_FALSE);
while (l2 > 0) { while (l2 > 0) {
l1--; l1--;
@@ -378,17 +378,17 @@ dns_name_issubdomain(dns_name_t *name1, dns_name_t *name2) {
count2 = *label2++; count2 = *label2++;
if (count1 <= 63 && count2 <= 63) { if (count1 <= 63 && count2 <= 63) {
if (count1 != count2) if (count1 != count2)
return (DNS_FALSE); return (ISC_FALSE);
while (count2 > 0) { while (count2 > 0) {
count2--; count2--;
c1 = maptolower[*label1++]; c1 = maptolower[*label1++];
c2 = maptolower[*label2++]; c2 = maptolower[*label2++];
if (c1 != c2) if (c1 != c2)
return (DNS_FALSE); return (ISC_FALSE);
} }
} else { } else {
if (count1 != count2) if (count1 != count2)
return (DNS_FALSE); return (ISC_FALSE);
INSIST(count1 == DNS_LABELTYPE_BITSTRING && INSIST(count1 == DNS_LABELTYPE_BITSTRING &&
count2 == DNS_LABELTYPE_BITSTRING); count2 == DNS_LABELTYPE_BITSTRING);
count1 = *label1++; count1 = *label1++;
@@ -398,20 +398,20 @@ dns_name_issubdomain(dns_name_t *name1, dns_name_t *name2) {
if (count2 == 0) if (count2 == 0)
count2 = 256; count2 = 256;
if (count1 < count2) if (count1 < count2)
return (DNS_FALSE); return (ISC_FALSE);
/* Yes, this loop is really slow! */ /* Yes, this loop is really slow! */
for (n = 0; n < count2; n++) { for (n = 0; n < count2; n++) {
b1 = get_bit(label1, n); b1 = get_bit(label1, n);
b2 = get_bit(label2, n); b2 = get_bit(label2, n);
if (b1 != b2) if (b1 != b2)
return (DNS_FALSE); return (ISC_FALSE);
} }
if (count1 != count2 && l2 != 0) if (count1 != count2 && l2 != 0)
return (DNS_FALSE); return (ISC_FALSE);
} }
} }
return (DNS_TRUE); return (ISC_TRUE);
} }
unsigned int unsigned int
@@ -467,11 +467,11 @@ dns_name_getlabelsequence(dns_name_t *source,
source->offsets[first]; source->offsets[first];
target->labels = n; target->labels = n;
set_offsets(target, DNS_FALSE, DNS_FALSE); set_offsets(target, ISC_FALSE, ISC_FALSE);
} }
void void
dns_name_fromregion(dns_name_t *name, dns_region_t *r) { dns_name_fromregion(dns_name_t *name, isc_region_t *r) {
/* /*
* Make 'name' refer to region 'r'. * Make 'name' refer to region 'r'.
*/ */
@@ -484,13 +484,13 @@ dns_name_fromregion(dns_name_t *name, dns_region_t *r) {
name->length = r->length; name->length = r->length;
if (r->length > 0) if (r->length > 0)
set_offsets(name, DNS_TRUE, DNS_TRUE); set_offsets(name, ISC_TRUE, ISC_TRUE);
else else
name->labels = 0; name->labels = 0;
} }
void void
dns_name_toregion(dns_name_t *name, dns_region_t *r) { dns_name_toregion(dns_name_t *name, isc_region_t *r) {
/* /*
* Make 'r' refer to 'name'. * Make 'r' refer to 'name'.
*/ */
@@ -504,9 +504,9 @@ dns_name_toregion(dns_name_t *name, dns_region_t *r) {
dns_result_t dns_result_t
dns_name_fromtext(dns_name_t *name, dns_textregion_t *source, dns_name_fromtext(dns_name_t *name, isc_textregion_t *source,
dns_name_t *origin, dns_boolean_t downcase, dns_name_t *origin, isc_boolean_t downcase,
dns_region_t *target) isc_region_t *target)
{ {
unsigned char *ndata, *label; unsigned char *ndata, *label;
char *tdata; char *tdata;
@@ -514,7 +514,7 @@ dns_name_fromtext(dns_name_t *name, dns_textregion_t *source,
tw_state state, kind; tw_state state, kind;
unsigned int value, count, tbcount, bitlength, maxlength; unsigned int value, count, tbcount, bitlength, maxlength;
unsigned int n1, n2, vlen, tlen, nrem, digits, labels; unsigned int n1, n2, vlen, tlen, nrem, digits, labels;
dns_boolean_t done, saw_bitstring; isc_boolean_t done, saw_bitstring;
unsigned char dqchars[4]; unsigned char dqchars[4];
/* /*
@@ -562,8 +562,8 @@ dns_name_fromtext(dns_name_t *name, dns_textregion_t *source,
if (nrem > 255) if (nrem > 255)
nrem = 255; nrem = 255;
labels = 0; labels = 0;
done = DNS_FALSE; done = ISC_FALSE;
saw_bitstring = DNS_FALSE; saw_bitstring = ISC_FALSE;
state = tw_init; state = tw_init;
while (nrem > 0 && tlen > 0 && !done) { while (nrem > 0 && tlen > 0 && !done) {
@@ -582,7 +582,7 @@ dns_name_fromtext(dns_name_t *name, dns_textregion_t *source,
labels++; labels++;
*ndata++ = 0; *ndata++ = 0;
nrem--; nrem--;
done = DNS_TRUE; done = ISC_TRUE;
break; break;
} }
/* FALLTHROUGH */ /* FALLTHROUGH */
@@ -608,7 +608,7 @@ dns_name_fromtext(dns_name_t *name, dns_textregion_t *source,
labels++; labels++;
*ndata++ = 0; *ndata++ = 0;
nrem--; nrem--;
done = DNS_TRUE; done = ISC_TRUE;
} }
state = tw_start; state = tw_start;
} else if (c == '\\') { } else if (c == '\\') {
@@ -626,7 +626,7 @@ dns_name_fromtext(dns_name_t *name, dns_textregion_t *source,
break; break;
case tw_initialescape: case tw_initialescape:
if (c == '[') { if (c == '[') {
saw_bitstring = DNS_TRUE; saw_bitstring = ISC_TRUE;
kind = tw_bitstring; kind = tw_bitstring;
state = tw_bitstring; state = tw_bitstring;
*label = DNS_LABELTYPE_BITSTRING; *label = DNS_LABELTYPE_BITSTRING;
@@ -903,7 +903,7 @@ dns_name_fromtext(dns_name_t *name, dns_textregion_t *source,
labels++; labels++;
*ndata++ = 0; *ndata++ = 0;
nrem--; nrem--;
done = DNS_TRUE; done = ISC_TRUE;
} }
state = tw_start; state = tw_start;
break; break;
@@ -946,7 +946,7 @@ dns_name_fromtext(dns_name_t *name, dns_textregion_t *source,
/* /*
* We should build the offsets table directly. * We should build the offsets table directly.
*/ */
set_offsets(name, DNS_FALSE, DNS_FALSE); set_offsets(name, ISC_FALSE, ISC_FALSE);
if (saw_bitstring) if (saw_bitstring)
compact(name); compact(name);
@@ -955,8 +955,8 @@ dns_name_fromtext(dns_name_t *name, dns_textregion_t *source,
} }
dns_result_t dns_result_t
dns_name_totext(dns_name_t *name, dns_boolean_t omit_final_dot, dns_name_totext(dns_name_t *name, isc_boolean_t omit_final_dot,
dns_textregion_t *target, unsigned int *bytesp) isc_textregion_t *target, unsigned int *bytesp)
{ {
unsigned char *ndata; unsigned char *ndata;
char *tdata; char *tdata;
@@ -966,7 +966,7 @@ dns_name_totext(dns_name_t *name, dns_boolean_t omit_final_dot,
unsigned int bytes, nibbles; unsigned int bytes, nibbles;
size_t i, len; size_t i, len;
unsigned int labels; unsigned int labels;
dns_boolean_t saw_root = DNS_FALSE; isc_boolean_t saw_root = ISC_FALSE;
char num[4]; char num[4];
/* /*
@@ -985,7 +985,7 @@ dns_name_totext(dns_name_t *name, dns_boolean_t omit_final_dot,
/* Special handling for root label. */ /* Special handling for root label. */
if (nlen == 1 && labels == 1 && *ndata == 0) { if (nlen == 1 && labels == 1 && *ndata == 0) {
saw_root = DNS_TRUE; saw_root = ISC_TRUE;
labels = 0; labels = 0;
nlen = 0; nlen = 0;
if (trem == 0) if (trem == 0)
@@ -999,7 +999,7 @@ dns_name_totext(dns_name_t *name, dns_boolean_t omit_final_dot,
count = *ndata++; count = *ndata++;
nlen--; nlen--;
if (count == 0) { if (count == 0) {
saw_root = DNS_TRUE; saw_root = ISC_TRUE;
break; break;
} }
if (count < 64) { if (count < 64) {
@@ -1111,8 +1111,8 @@ dns_name_totext(dns_name_t *name, dns_boolean_t omit_final_dot,
} }
static void static void
set_offsets(dns_name_t *name, dns_boolean_t set_labels, set_offsets(dns_name_t *name, isc_boolean_t set_labels,
dns_boolean_t set_length) { isc_boolean_t set_length) {
unsigned int offset, count, nlabels, nrem, n; unsigned int offset, count, nlabels, nrem, n;
unsigned char *ndata; unsigned char *ndata;