mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 14:07:59 +00:00
eliminate dns_ types that duplicate isc_ types
This commit is contained in:
parent
77e58a7e01
commit
38d2d0e932
@ -50,8 +50,8 @@ main(int argc, char *argv[]) {
|
||||
unsigned int tbytes;
|
||||
dns_result_t result;
|
||||
dns_name_t name, oname, compname;
|
||||
dns_textregion_t source, ttarget;
|
||||
dns_region_t target, r;
|
||||
isc_textregion_t source, ttarget;
|
||||
isc_region_t target, r;
|
||||
dns_name_t *origin, *comp;
|
||||
isc_boolean_t downcase = ISC_FALSE;
|
||||
|
||||
|
@ -72,6 +72,8 @@
|
||||
*** Imports
|
||||
***/
|
||||
|
||||
#include <isc/boolean.h>
|
||||
|
||||
#include <dns/types.h>
|
||||
#include <dns/result.h>
|
||||
|
||||
@ -197,7 +199,7 @@ void dns_name_init(dns_name_t *name);
|
||||
*** 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?
|
||||
*
|
||||
@ -236,7 +238,7 @@ int dns_name_compare(dns_name_t *name1, dns_name_t *name2);
|
||||
* 1 'name1' is greater than 'name2'
|
||||
*/
|
||||
|
||||
dns_boolean_t
|
||||
isc_boolean_t
|
||||
dns_name_issubdomain(dns_name_t *name1, dns_name_t *name2);
|
||||
/*
|
||||
* Is 'name1' a subdomain of 'name2'?
|
||||
@ -328,7 +330,7 @@ void dns_name_getlabelsequence(dns_name_t *source,
|
||||
*** 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'.
|
||||
*
|
||||
@ -343,7 +345,7 @@ void dns_name_fromregion(dns_name_t *name, dns_region_t *r);
|
||||
* 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'.
|
||||
*
|
||||
@ -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_region_t *source,
|
||||
isc_region_t *source,
|
||||
dns_decompression_t *dctx,
|
||||
dns_boolean_t downcase,
|
||||
dns_region_t *target);
|
||||
isc_boolean_t downcase,
|
||||
isc_region_t *target);
|
||||
/*
|
||||
* 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_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
|
||||
* 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_textregion_t *source,
|
||||
isc_textregion_t *source,
|
||||
dns_name_t *origin,
|
||||
dns_boolean_t downcase,
|
||||
dns_region_t *target);
|
||||
isc_boolean_t downcase,
|
||||
isc_region_t *target);
|
||||
/*
|
||||
* Convert the textual representation of a DNS name at source
|
||||
* 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_boolean_t omit_final_dot,
|
||||
dns_textregion_t *target, unsigned int *bytesp);
|
||||
isc_boolean_t omit_final_dot,
|
||||
isc_textregion_t *target, unsigned int *bytesp);
|
||||
/*
|
||||
* Convert 'name' into text format, storing the result in 'target'.
|
||||
*
|
||||
|
@ -27,17 +27,9 @@
|
||||
*/
|
||||
|
||||
#include <isc/region.h>
|
||||
#include <isc/boolean.h>
|
||||
|
||||
#define DNS_TRUE ISC_TRUE
|
||||
#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 isc_region_t dns_label_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_decompression dns_decompression_t;
|
||||
typedef unsigned int dns_rdataclass_t;
|
||||
|
@ -115,7 +115,7 @@ static struct dns_name root = { "", 1, 1 };
|
||||
|
||||
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 *);
|
||||
|
||||
/*
|
||||
@ -221,7 +221,7 @@ dns_name_init(dns_name_t *name) {
|
||||
name->labels = 0;
|
||||
}
|
||||
|
||||
dns_boolean_t
|
||||
isc_boolean_t
|
||||
dns_name_isabsolute(dns_name_t *name) {
|
||||
/*
|
||||
* Does 'name' end in the root label?
|
||||
@ -230,8 +230,8 @@ dns_name_isabsolute(dns_name_t *name) {
|
||||
REQUIRE(VALID_NAME(name));
|
||||
|
||||
if (name->ndata[name->offsets[name->labels - 1]] == 0)
|
||||
return (DNS_TRUE);
|
||||
return (DNS_FALSE);
|
||||
return (ISC_TRUE);
|
||||
return (ISC_FALSE);
|
||||
}
|
||||
|
||||
int
|
||||
@ -338,9 +338,9 @@ dns_name_compare(dns_name_t *name1, dns_name_t *name2) {
|
||||
return (ldiff);
|
||||
}
|
||||
|
||||
dns_boolean_t
|
||||
isc_boolean_t
|
||||
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 b1, b2, n;
|
||||
unsigned char c1, c2;
|
||||
@ -367,7 +367,7 @@ dns_name_issubdomain(dns_name_t *name1, dns_name_t *name2) {
|
||||
l1 = name1->labels;
|
||||
l2 = name2->labels;
|
||||
if (l1 < l2)
|
||||
return (DNS_FALSE);
|
||||
return (ISC_FALSE);
|
||||
|
||||
while (l2 > 0) {
|
||||
l1--;
|
||||
@ -378,17 +378,17 @@ dns_name_issubdomain(dns_name_t *name1, dns_name_t *name2) {
|
||||
count2 = *label2++;
|
||||
if (count1 <= 63 && count2 <= 63) {
|
||||
if (count1 != count2)
|
||||
return (DNS_FALSE);
|
||||
return (ISC_FALSE);
|
||||
while (count2 > 0) {
|
||||
count2--;
|
||||
c1 = maptolower[*label1++];
|
||||
c2 = maptolower[*label2++];
|
||||
if (c1 != c2)
|
||||
return (DNS_FALSE);
|
||||
return (ISC_FALSE);
|
||||
}
|
||||
} else {
|
||||
if (count1 != count2)
|
||||
return (DNS_FALSE);
|
||||
return (ISC_FALSE);
|
||||
INSIST(count1 == DNS_LABELTYPE_BITSTRING &&
|
||||
count2 == DNS_LABELTYPE_BITSTRING);
|
||||
count1 = *label1++;
|
||||
@ -398,20 +398,20 @@ dns_name_issubdomain(dns_name_t *name1, dns_name_t *name2) {
|
||||
if (count2 == 0)
|
||||
count2 = 256;
|
||||
if (count1 < count2)
|
||||
return (DNS_FALSE);
|
||||
return (ISC_FALSE);
|
||||
/* Yes, this loop is really slow! */
|
||||
for (n = 0; n < count2; n++) {
|
||||
b1 = get_bit(label1, n);
|
||||
b2 = get_bit(label2, n);
|
||||
if (b1 != b2)
|
||||
return (DNS_FALSE);
|
||||
return (ISC_FALSE);
|
||||
}
|
||||
if (count1 != count2 && l2 != 0)
|
||||
return (DNS_FALSE);
|
||||
return (ISC_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
return (DNS_TRUE);
|
||||
return (ISC_TRUE);
|
||||
}
|
||||
|
||||
unsigned int
|
||||
@ -467,11 +467,11 @@ dns_name_getlabelsequence(dns_name_t *source,
|
||||
source->offsets[first];
|
||||
target->labels = n;
|
||||
|
||||
set_offsets(target, DNS_FALSE, DNS_FALSE);
|
||||
set_offsets(target, ISC_FALSE, ISC_FALSE);
|
||||
}
|
||||
|
||||
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'.
|
||||
*/
|
||||
@ -484,13 +484,13 @@ dns_name_fromregion(dns_name_t *name, dns_region_t *r) {
|
||||
name->length = r->length;
|
||||
|
||||
if (r->length > 0)
|
||||
set_offsets(name, DNS_TRUE, DNS_TRUE);
|
||||
set_offsets(name, ISC_TRUE, ISC_TRUE);
|
||||
else
|
||||
name->labels = 0;
|
||||
}
|
||||
|
||||
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'.
|
||||
*/
|
||||
@ -504,9 +504,9 @@ dns_name_toregion(dns_name_t *name, dns_region_t *r) {
|
||||
|
||||
|
||||
dns_result_t
|
||||
dns_name_fromtext(dns_name_t *name, dns_textregion_t *source,
|
||||
dns_name_t *origin, dns_boolean_t downcase,
|
||||
dns_region_t *target)
|
||||
dns_name_fromtext(dns_name_t *name, isc_textregion_t *source,
|
||||
dns_name_t *origin, isc_boolean_t downcase,
|
||||
isc_region_t *target)
|
||||
{
|
||||
unsigned char *ndata, *label;
|
||||
char *tdata;
|
||||
@ -514,7 +514,7 @@ dns_name_fromtext(dns_name_t *name, dns_textregion_t *source,
|
||||
tw_state state, kind;
|
||||
unsigned int value, count, tbcount, bitlength, maxlength;
|
||||
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];
|
||||
|
||||
/*
|
||||
@ -562,8 +562,8 @@ dns_name_fromtext(dns_name_t *name, dns_textregion_t *source,
|
||||
if (nrem > 255)
|
||||
nrem = 255;
|
||||
labels = 0;
|
||||
done = DNS_FALSE;
|
||||
saw_bitstring = DNS_FALSE;
|
||||
done = ISC_FALSE;
|
||||
saw_bitstring = ISC_FALSE;
|
||||
state = tw_init;
|
||||
|
||||
while (nrem > 0 && tlen > 0 && !done) {
|
||||
@ -582,7 +582,7 @@ dns_name_fromtext(dns_name_t *name, dns_textregion_t *source,
|
||||
labels++;
|
||||
*ndata++ = 0;
|
||||
nrem--;
|
||||
done = DNS_TRUE;
|
||||
done = ISC_TRUE;
|
||||
break;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
@ -608,7 +608,7 @@ dns_name_fromtext(dns_name_t *name, dns_textregion_t *source,
|
||||
labels++;
|
||||
*ndata++ = 0;
|
||||
nrem--;
|
||||
done = DNS_TRUE;
|
||||
done = ISC_TRUE;
|
||||
}
|
||||
state = tw_start;
|
||||
} else if (c == '\\') {
|
||||
@ -626,7 +626,7 @@ dns_name_fromtext(dns_name_t *name, dns_textregion_t *source,
|
||||
break;
|
||||
case tw_initialescape:
|
||||
if (c == '[') {
|
||||
saw_bitstring = DNS_TRUE;
|
||||
saw_bitstring = ISC_TRUE;
|
||||
kind = tw_bitstring;
|
||||
state = tw_bitstring;
|
||||
*label = DNS_LABELTYPE_BITSTRING;
|
||||
@ -903,7 +903,7 @@ dns_name_fromtext(dns_name_t *name, dns_textregion_t *source,
|
||||
labels++;
|
||||
*ndata++ = 0;
|
||||
nrem--;
|
||||
done = DNS_TRUE;
|
||||
done = ISC_TRUE;
|
||||
}
|
||||
state = tw_start;
|
||||
break;
|
||||
@ -946,7 +946,7 @@ dns_name_fromtext(dns_name_t *name, dns_textregion_t *source,
|
||||
/*
|
||||
* We should build the offsets table directly.
|
||||
*/
|
||||
set_offsets(name, DNS_FALSE, DNS_FALSE);
|
||||
set_offsets(name, ISC_FALSE, ISC_FALSE);
|
||||
|
||||
if (saw_bitstring)
|
||||
compact(name);
|
||||
@ -955,8 +955,8 @@ dns_name_fromtext(dns_name_t *name, dns_textregion_t *source,
|
||||
}
|
||||
|
||||
dns_result_t
|
||||
dns_name_totext(dns_name_t *name, dns_boolean_t omit_final_dot,
|
||||
dns_textregion_t *target, unsigned int *bytesp)
|
||||
dns_name_totext(dns_name_t *name, isc_boolean_t omit_final_dot,
|
||||
isc_textregion_t *target, unsigned int *bytesp)
|
||||
{
|
||||
unsigned char *ndata;
|
||||
char *tdata;
|
||||
@ -966,7 +966,7 @@ dns_name_totext(dns_name_t *name, dns_boolean_t omit_final_dot,
|
||||
unsigned int bytes, nibbles;
|
||||
size_t i, len;
|
||||
unsigned int labels;
|
||||
dns_boolean_t saw_root = DNS_FALSE;
|
||||
isc_boolean_t saw_root = ISC_FALSE;
|
||||
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. */
|
||||
if (nlen == 1 && labels == 1 && *ndata == 0) {
|
||||
saw_root = DNS_TRUE;
|
||||
saw_root = ISC_TRUE;
|
||||
labels = 0;
|
||||
nlen = 0;
|
||||
if (trem == 0)
|
||||
@ -999,7 +999,7 @@ dns_name_totext(dns_name_t *name, dns_boolean_t omit_final_dot,
|
||||
count = *ndata++;
|
||||
nlen--;
|
||||
if (count == 0) {
|
||||
saw_root = DNS_TRUE;
|
||||
saw_root = ISC_TRUE;
|
||||
break;
|
||||
}
|
||||
if (count < 64) {
|
||||
@ -1111,8 +1111,8 @@ dns_name_totext(dns_name_t *name, dns_boolean_t omit_final_dot,
|
||||
}
|
||||
|
||||
static void
|
||||
set_offsets(dns_name_t *name, dns_boolean_t set_labels,
|
||||
dns_boolean_t set_length) {
|
||||
set_offsets(dns_name_t *name, isc_boolean_t set_labels,
|
||||
isc_boolean_t set_length) {
|
||||
unsigned int offset, count, nlabels, nrem, n;
|
||||
unsigned char *ndata;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user