Adjusted error codes.

txt_fromwire() was not coping with a zero length active buffer.
This commit is contained in:
Mark Andrews 1999-01-20 05:20:24 +00:00
parent 47db0e1d06
commit 3d5cad69ec
37 changed files with 858 additions and 587 deletions

View file

@ -54,11 +54,21 @@ main(int argc, char *argv[]) {
int wire = 0;
dns_compress_t cctx;
dns_decompress_t dctx;
int trunc = 0;
int add = 0;
int len;
int zero = 0;
int debug = 0;
while ((c = getopt(argc, argv, "qsw")) != -1) {
while ((c = getopt(argc, argv, "dqswtaz")) != -1) {
switch (c) {
case 'd':
debug = 1;
quiet = 0;
break;
case 'q':
quiet = 1;
debug = 0;
break;
case 's':
stats = 1;
@ -66,6 +76,15 @@ main(int argc, char *argv[]) {
case 'w':
wire = 1;
break;
case 't':
trunc = 1;
break;
case 'a':
add = 1;
break;
case 'z':
zero = 1;
break;
}
}
@ -81,15 +100,14 @@ main(int argc, char *argv[]) {
specials[')'] = 1;
specials['"'] = 1;
isc_lex_setspecials(lex, specials);
options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF |
ISC_LEXOPT_INITIALWS | ISC_LEXOPT_QSTRING;
options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
isc_lex_setcomments(lex, ISC_LEXCOMMENT_DNSMASTERFILE);
RUNTIME_CHECK(isc_lex_openstream(lex, stdin) == ISC_R_SUCCESS);
while ((result = isc_lex_gettoken(lex, options | ISC_LEXOPT_NUMBER,
&token)) == ISC_R_SUCCESS) {
/* fprintf(stdout, "token.type = %d\n", token.type); */
if (debug) fprintf(stdout, "token.type = %d\n", token.type);
if (token.type == isc_tokentype_special) {
if (token.value.as_char == '(') {
parens++;
@ -130,10 +148,9 @@ main(int argc, char *argv[]) {
NULL, ISC_FALSE, &dbuf);
if (result != DNS_R_SUCCESS) {
fprintf(stdout,
"dns_rdata_fromtext != DNS_R_SUCCESS\n");
"dns_rdata_fromtext returned %s(%d)\n",
dns_result_totext(result), result);
fflush(stdout);
need_eol = 1;
continue;
}
@ -141,20 +158,32 @@ main(int argc, char *argv[]) {
if (wire) {
isc_buffer_init(&wbuf, wirebuf, sizeof(wirebuf),
ISC_BUFFERTYPE_BINARY);
if (dns_rdata_towire(&rdata, &cctx, &wbuf)
!= DNS_R_SUCCESS) {
result = dns_rdata_towire(&rdata, &cctx, &wbuf);
if (result != DNS_R_SUCCESS) {
fprintf(stdout,
"dns_rdata_towire != DNS_R_SUCCESS\n");
fflush(stdout);
"dns_rdata_towire returned %s(%d)\n",
dns_result_totext(result), result);
continue;
}
len = wbuf.used - dbuf.current;
if (zero)
len = 0;
if (trunc)
len = (len * 3) / 4;
if (add) {
isc_buffer_add(&wbuf, len / 4 + 1);
len += len / 4 + 1;
}
isc_buffer_setactive(&wbuf, len);
dns_rdata_init(&rdata);
isc_buffer_init(&dbuf, inbuf, sizeof(inbuf),
ISC_BUFFERTYPE_BINARY);
if (dns_rdata_fromwire(&rdata, 1, type, &wbuf, &dctx,
ISC_FALSE, &dbuf) != DNS_R_SUCCESS) {
result = dns_rdata_fromwire(&rdata, 1, type, &wbuf,
&dctx, ISC_FALSE, &dbuf);
if (result != DNS_R_SUCCESS) {
fprintf(stdout,
"dns_rdata_fromwire != DNS_R_SUCCESS\n");
"dns_rdata_fromwire returned %s(%d)\n",
dns_result_totext(result), result);
fflush(stdout);
continue;
}
@ -162,8 +191,10 @@ main(int argc, char *argv[]) {
isc_buffer_init(&tbuf, outbuf, sizeof(outbuf),
ISC_BUFFERTYPE_TEXT);
if (dns_rdata_totext(&rdata, &tbuf) != DNS_R_SUCCESS)
fprintf(stdout, "dns_rdata_totext != DNS_R_SUCCESS\n");
result = dns_rdata_totext(&rdata, &tbuf);
if (result != DNS_R_SUCCESS)
fprintf(stdout, "dns_rdata_totext returned %s(%d)\n",
dns_result_totext(result), result);
else
fprintf(stdout, "\"%.*s\"\n",
(int)tbuf.used, (char*)tbuf.base);

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: gen.c,v 1.6 1999/01/19 05:38:31 marka Exp $ */
/* $Id: gen.c,v 1.7 1999/01/20 05:20:18 marka Exp $ */
#include <sys/types.h>
@ -32,43 +32,43 @@
#define FROMTEXTARGS "class, type, lexer, origin, downcase, target"
#define FROMTEXTCLASS "class"
#define FROMTEXTTYPE "type"
#define FROMTEXTDEF "DNS_R_DEFAULT"
#define FROMTEXTDEF "use_default = ISC_TRUE"
#define TOTEXTDECL "dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target"
#define TOTEXTARGS "rdata, origin, target"
#define TOTEXTCLASS "rdata->class"
#define TOTEXTTYPE "rdata->type"
#define TOTEXTDEF "DNS_R_DEFAULT"
#define TOTEXTDEF "use_default = ISC_TRUE"
#define FROMWIREDECL "dns_rdataclass_t class, dns_rdatatype_t type, isc_buffer_t *source, dns_decompress_t *dctx, isc_boolean_t downcase, isc_buffer_t *target"
#define FROMWIREARGS "class, type, source, dctx, downcase, target"
#define FROMWIRECLASS "class"
#define FROMWIRETYPE "type"
#define FROMWIREDEF "DNS_R_DEFAULT"
#define FROMWIREDEF "use_default = ISC_TRUE"
#define TOWIREDECL "dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target"
#define TOWIREARGS "rdata, cctx, target"
#define TOWIRECLASS "rdata->class"
#define TOWIRETYPE "rdata->type"
#define TOWIREDEF "DNS_R_DEFAULT"
#define TOWIREDEF "use_default = ISC_TRUE"
#define FROMSTRUCTDECL "dns_rdataclass_t class, dns_rdatatype_t type, void *source, isc_buffer_t *target"
#define FROMSTRUCTARGS "class, type, source, target"
#define FROMSTRUCTCLASS "class"
#define FROMSTRUCTTYPE "type"
#define FROMSTRUCTDEF "DNS_R_DEFAULT"
#define FROMSTRUCTDEF "use_default = ISC_TRUE"
#define TOSTRUCTDECL "dns_rdata_t *rdata, void *target"
#define TOSTRUCTARGS "rdata, target"
#define TOSTRUCTCLASS "rdata->class"
#define TOSTRUCTTYPE "rdata->type"
#define TOSTRUCTDEF "DNS_R_DEFAULT"
#define TOSTRUCTDEF "use_default = ISC_TRUE"
#define COMPAREDECL "dns_rdata_t *rdata1, dns_rdata_t *rdata2"
#define COMPAREARGS "rdata1, rdata2"
#define COMPARECLASS "rdata1->class"
#define COMPARETYPE "rdata1->type"
#define COMPAREDEF "-2"
#define COMPAREDEF "use_default = ISC_TRUE"
char copyright[] =
"/*\n\
@ -141,8 +141,7 @@ doswitch(char *name, char *function, char *args,
first = 0;
}
if (tt->type != lasttype && subswitch) {
fprintf(stdout, "\t\tdefault: result = %s; break; \\\n",
res);
fprintf(stdout, "\t\tdefault: %s; break; \\\n", res);
fputs(/*{*/ "\t\t} \\\n", stdout);
fputs("\t\tbreak; \\\n", stdout);
subswitch = 0;
@ -165,14 +164,14 @@ doswitch(char *name, char *function, char *args,
lasttype = tt->type;
}
if (subswitch) {
fprintf(stdout, "\t\tdefault: result = %s; break; \\\n", res);
fprintf(stdout, "\t\tdefault: %s; break; \\\n", res);
fputs(/*{*/ "\t\t}\n", stdout);
fputs("\t\tbreak; \\\n", stdout);
}
if (first)
fprintf(stdout, "\n#define %s result = %s;\n", name, res);
fprintf(stdout, "\n#define %s %s;\n", name, res);
else {
fprintf(stdout, "\tdefault: result = %s; break; \\\n", res);
fprintf(stdout, "\tdefault: %s; break; \\\n", res);
fputs(/*{*/ "\t}\n", stdout);
}
}
@ -215,23 +214,23 @@ add(int class, char *classname, int type, char *typename, char *dirname) {
tt = types;
oldtt = NULL;
while (tt && (tt->type < type)) {
while ((tt != NULL) && (tt->type < type)) {
oldtt = tt;
tt = tt->next;
}
while (tt && (tt->type == type) && (tt->class < class)) {
while ((tt != NULL) && (tt->type == type) && (tt->class < class)) {
if (strcmp(tt->typename, typename) != 0)
exit(1);
oldtt = tt;
tt = tt->next;
}
if (tt && (tt->type == type) && (tt->class == class))
if ((tt != NULL) && (tt->type == type) && (tt->class == class))
exit(1);
newtt->next = tt;
if (oldtt)
if (oldtt != NULL)
oldtt->next = newtt;
else
types = newtt;
@ -246,18 +245,18 @@ add(int class, char *classname, int type, char *typename, char *dirname) {
cc = classes;
oldcc = NULL;
while (cc && (cc->type < type)) {
while ((cc != NULL) && (cc->type < type)) {
oldcc = cc;
cc = cc->next;
}
if (cc && cc->type == type) {
if ((cc != NULL) && cc->type == type) {
free((char *)newcc);
return;
}
newcc->next = cc;
if (oldcc)
if (oldcc != NULL)
oldcc->next = newcc;
else
classes = newcc;

View file

@ -37,10 +37,11 @@ typedef unsigned int dns_result_t;
#define DNS_R_TOOMANYHOPS 14
#define DNS_R_DISALLOWED 15
#define DNS_R_NOMORE 16
#define DNS_R_WIRE 17
#define DNS_R_DEFAULT 18
#define DNS_R_EXTRATOKEN 17
#define DNS_R_EXTRADATA 18
#define DNS_R_TEXTTOLONG 19
#define DNS_R_LASTENTRY 18 /* Last entry on list. */
#define DNS_R_LASTENTRY 19 /* Last entry on list. */
#define DNS_R_UNEXPECTED 0xFFFFFFFFL

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: rdata.c,v 1.4 1999/01/20 02:41:10 halley Exp $ */
/* $Id: rdata.c,v 1.5 1999/01/20 05:20:18 marka Exp $ */
#include <isc/buffer.h>
#include <isc/lex.h>
@ -71,8 +71,9 @@ dns_rdata_init(dns_rdata_t *rdata) {
int
dns_rdata_compare(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
int result;
int result = 0;
int l;
isc_boolean_t use_default = ISC_FALSE;
REQUIRE(rdata1 != NULL);
REQUIRE(rdata2 != NULL);
@ -87,7 +88,7 @@ dns_rdata_compare(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
COMPARESWITCH
if (result == -2) {
if (use_default) {
l = (rdata1->length > rdata2->length) ?
rdata1->length : rdata2->length;
if ((result = memcmp(rdata1->data, rdata2->data, l)) == 0)
@ -127,10 +128,11 @@ dns_rdata_fromwire(dns_rdata_t *rdata,
dns_decompress_t *dctx,
isc_boolean_t downcase,
isc_buffer_t *target) {
dns_result_t result;
dns_result_t result = DNS_R_NOTIMPLEMENTED;
isc_region_t region;
isc_buffer_t ss;
isc_buffer_t st;
isc_boolean_t use_default = ISC_FALSE;
ss = *source;
st = *target;
@ -138,12 +140,12 @@ dns_rdata_fromwire(dns_rdata_t *rdata,
FROMWIRESWITCH
if (result == DNS_R_DEFAULT)
result = DNS_R_NOTIMPLEMENTED;
if (use_default)
(void)NULL;
/* We should have consumed all out buffer */
if (!buffer_empty(source))
result = DNS_R_WIRE;
if (result == DNS_R_SUCCESS && !buffer_empty(source))
result = DNS_R_EXTRADATA;
if (rdata && result == DNS_R_SUCCESS) {
region.length = target->used - st.used;
@ -160,11 +162,12 @@ dns_rdata_fromwire(dns_rdata_t *rdata,
dns_result_t
dns_rdata_towire(dns_rdata_t *rdata, dns_compress_t *cctx,
isc_buffer_t *target) {
dns_result_t result;
dns_result_t result = DNS_R_NOTIMPLEMENTED;
isc_boolean_t use_default = ISC_FALSE;
TOWIRESWITCH
if (result == DNS_R_DEFAULT) {
if (use_default) {
if (target->length < rdata->length)
return (DNS_R_NOSPACE);
memcpy(target->base, rdata->data, rdata->length);
@ -180,17 +183,39 @@ dns_rdata_fromtext(dns_rdata_t *rdata,
isc_lex_t *lexer, dns_name_t *origin,
isc_boolean_t downcase,
isc_buffer_t *target) {
dns_result_t result;
dns_result_t result = DNS_R_NOTIMPLEMENTED;
isc_region_t region;
isc_buffer_t st;
isc_boolean_t use_default = ISC_FALSE;
isc_token_t token;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
st = *target;
region.base = target->base + target->used;
FROMTEXTSWITCH
if (result == DNS_R_DEFAULT)
result = DNS_R_NOTIMPLEMENTED;
if (use_default)
(void)NULL;
/*
* Consume to end of line / file.
* If not at end of line initially set error code.
*/
do {
if (isc_lex_gettoken(lexer, options, &token)
!= ISC_R_SUCCESS) {
if (result == DNS_R_SUCCESS)
result = DNS_R_UNEXPECTED;
break;
} else if (token.type != isc_tokentype_eol &&
token.type != isc_tokentype_eof) {
fprintf(stderr, "token_type = %d\n", token.type);
if (result == DNS_R_SUCCESS)
result = DNS_R_EXTRATOKEN;
} else
break;
} while (1);
if (rdata != NULL && result == DNS_R_SUCCESS) {
region.length = target->used - st.used;
@ -204,13 +229,15 @@ dns_rdata_fromtext(dns_rdata_t *rdata,
dns_result_t
dns_rdata_totext(dns_rdata_t *rdata, isc_buffer_t *target) {
dns_result_t result;
dns_result_t result = DNS_R_NOTIMPLEMENTED;
dns_name_t *origin = NULL;
isc_boolean_t use_default = ISC_FALSE;
TOTEXTSWITCH
if (result == DNS_R_DEFAULT)
result = DNS_R_NOTIMPLEMENTED;
if (use_default)
(void)NULL;
return (result);
}
@ -219,17 +246,18 @@ dns_rdata_fromstruct(dns_rdata_t *rdata,
dns_rdataclass_t class, dns_rdatatype_t type,
void *source,
isc_buffer_t *target) {
dns_result_t result;
dns_result_t result = DNS_R_NOTIMPLEMENTED;
isc_buffer_t st;
isc_region_t region;
isc_boolean_t use_default = ISC_FALSE;
region.base = target->base + target->used;
st = *target;
FROMSTRUCTSWITCH
if (result == DNS_R_DEFAULT)
result = DNS_R_NOTIMPLEMENTED;
if (use_default)
(void)NULL;
if (rdata != NULL && result == DNS_R_SUCCESS) {
region.length = target->used - st.used;
@ -242,12 +270,14 @@ dns_rdata_fromstruct(dns_rdata_t *rdata,
dns_result_t
dns_rdata_tostruct(dns_rdata_t *rdata, void *target) {
dns_result_t result;
dns_result_t result = DNS_R_NOTIMPLEMENTED;
isc_boolean_t use_default = ISC_FALSE;
TOSTRUCTSWITCH
if (result == DNS_R_DEFAULT)
result = DNS_R_NOTIMPLEMENTED;
if (use_default)
(void)NULL;
return (result);
}
@ -314,7 +344,7 @@ txt_fromtext(isc_textregion_t *source, isc_buffer_t *target) {
if (tregion.length < source->length + 1)
return (DNS_R_NOSPACE);
if (source->length > 255)
return (DNS_R_UNKNOWN);
return (DNS_R_TEXTTOLONG);
*tregion.base = source->length;
memcpy(tregion.base + 1, source->base, source->length);
isc_buffer_add(target, source->length + 1);
@ -328,9 +358,11 @@ txt_fromwire(isc_buffer_t *source, isc_buffer_t *target) {
isc_region_t tregion;
isc_buffer_active(source, &sregion);
if (sregion.length == 0)
return(DNS_R_UNEXPECTEDEND);
n = *sregion.base + 1;
if (n > sregion.length)
return (DNS_R_UNKNOWN);
return (DNS_R_UNEXPECTEDEND);
isc_buffer_available(target, &tregion);
if (n > tregion.length)
@ -396,6 +428,7 @@ buffer_fromregion(isc_buffer_t *buffer, isc_region_t *region,
isc_buffer_init(buffer, region->base, region->length, type);
isc_buffer_add(buffer, region->length);
isc_buffer_setactive(buffer, region->length);
}
static isc_result_t

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: cname_5.c,v 1.3 1999/01/19 06:49:29 marka Exp $ */
/* $Id: cname_5.c,v 1.4 1999/01/20 05:20:19 marka Exp $ */
#ifndef RDATA_GENERIC_CNAME_5_H
#define RDATA_GENERIC_CNAME_5_H
@ -27,15 +27,21 @@ fromtext_cname(dns_rdataclass_t class, dns_rdatatype_t type,
isc_token_t token;
dns_name_t name;
isc_buffer_t buffer;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 5);
REQUIRE(type == 5);
class = class; /*unused*/
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region,
@ -51,7 +57,7 @@ totext_cname(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
dns_name_t prefix;
isc_boolean_t sub;
INSIST(rdata->type == 5);
REQUIRE(rdata->type == 5);
dns_name_init(&name, NULL);
dns_name_init(&prefix, NULL);
@ -70,7 +76,7 @@ fromwire_cname(dns_rdataclass_t class, dns_rdatatype_t type,
isc_boolean_t downcase, isc_buffer_t *target) {
dns_name_t name;
INSIST(type == 5);
REQUIRE(type == 5);
class = class; /*unused*/
dns_name_init(&name, NULL);
@ -82,7 +88,7 @@ towire_cname(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
dns_name_t name;
isc_region_t region;
INSIST(rdata->type == 5);
REQUIRE(rdata->type == 5);
dns_name_init(&name, NULL);
dns_rdata_toregion(rdata, &region);
@ -98,9 +104,9 @@ compare_cname(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
isc_region_t region1;
isc_region_t region2;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == 5);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == 5);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
@ -118,7 +124,7 @@ static dns_result_t
fromstruct_cname(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 5);
REQUIRE(type == 5);
class = class; /*unused*/
@ -131,7 +137,7 @@ fromstruct_cname(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_cname(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 5);
REQUIRE(rdata->type == 5);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: cname_5.h,v 1.3 1999/01/19 06:49:29 marka Exp $ */
/* $Id: cname_5.h,v 1.4 1999/01/20 05:20:19 marka Exp $ */
#ifndef RDATA_GENERIC_CNAME_5_H
#define RDATA_GENERIC_CNAME_5_H
@ -27,15 +27,21 @@ fromtext_cname(dns_rdataclass_t class, dns_rdatatype_t type,
isc_token_t token;
dns_name_t name;
isc_buffer_t buffer;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 5);
REQUIRE(type == 5);
class = class; /*unused*/
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region,
@ -51,7 +57,7 @@ totext_cname(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
dns_name_t prefix;
isc_boolean_t sub;
INSIST(rdata->type == 5);
REQUIRE(rdata->type == 5);
dns_name_init(&name, NULL);
dns_name_init(&prefix, NULL);
@ -70,7 +76,7 @@ fromwire_cname(dns_rdataclass_t class, dns_rdatatype_t type,
isc_boolean_t downcase, isc_buffer_t *target) {
dns_name_t name;
INSIST(type == 5);
REQUIRE(type == 5);
class = class; /*unused*/
dns_name_init(&name, NULL);
@ -82,7 +88,7 @@ towire_cname(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
dns_name_t name;
isc_region_t region;
INSIST(rdata->type == 5);
REQUIRE(rdata->type == 5);
dns_name_init(&name, NULL);
dns_rdata_toregion(rdata, &region);
@ -98,9 +104,9 @@ compare_cname(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
isc_region_t region1;
isc_region_t region2;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == 5);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == 5);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
@ -118,7 +124,7 @@ static dns_result_t
fromstruct_cname(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 5);
REQUIRE(type == 5);
class = class; /*unused*/
@ -131,7 +137,7 @@ fromstruct_cname(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_cname(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 5);
REQUIRE(rdata->type == 5);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: hinfo_13.c,v 1.4 1999/01/19 06:49:29 marka Exp $ */
/* $Id: hinfo_13.c,v 1.5 1999/01/20 05:20:20 marka Exp $ */
#ifndef RDATA_GENERIC_HINFO_13_H
#define RDATA_GENERIC_HINFO_13_H
@ -26,26 +26,37 @@ fromtext_hinfo(dns_rdataclass_t class, dns_rdatatype_t type,
isc_boolean_t downcase, isc_buffer_t *target) {
isc_token_t token;
dns_result_t result;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 13);
REQUIRE(type == 13);
class = class; /*unused*/
origin = origin; /*unused*/
downcase = downcase; /*unused*/
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
result = txt_fromtext(&token.value.as_textregion, target);
if (result != DNS_R_SUCCESS)
return (result);
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
return (txt_fromtext(&token.value.as_textregion, target));
}
@ -54,7 +65,7 @@ totext_hinfo(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
isc_region_t region;
dns_result_t result;
INSIST(rdata->type == 13);
REQUIRE(rdata->type == 13);
origin = origin; /*unused*/
@ -78,7 +89,7 @@ fromwire_hinfo(dns_rdataclass_t class, dns_rdatatype_t type,
isc_boolean_t downcase, isc_buffer_t *target) {
dns_result_t result;
INSIST(type == 13);
REQUIRE(type == 13);
dctx = dctx; /* unused */
class = class; /* unused */
@ -95,7 +106,7 @@ static dns_result_t
towire_hinfo(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
isc_region_t region;
INSIST(rdata->type == 13);
REQUIRE(rdata->type == 13);
cctx = cctx;
@ -114,9 +125,9 @@ compare_hinfo(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
int l;
int result;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == 13);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == 13);
l = (rdata1->length < rdata2->length) ? rdata1->length : rdata2->length;
result = memcmp(rdata1->data, rdata2->data, l);
@ -133,7 +144,7 @@ static dns_result_t
fromstruct_hinfo(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 13);
REQUIRE(type == 13);
class = class; /*unused*/
@ -146,7 +157,7 @@ fromstruct_hinfo(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_hinfo(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 13);
REQUIRE(rdata->type == 13);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: hinfo_13.h,v 1.4 1999/01/19 06:49:29 marka Exp $ */
/* $Id: hinfo_13.h,v 1.5 1999/01/20 05:20:20 marka Exp $ */
#ifndef RDATA_GENERIC_HINFO_13_H
#define RDATA_GENERIC_HINFO_13_H
@ -26,26 +26,37 @@ fromtext_hinfo(dns_rdataclass_t class, dns_rdatatype_t type,
isc_boolean_t downcase, isc_buffer_t *target) {
isc_token_t token;
dns_result_t result;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 13);
REQUIRE(type == 13);
class = class; /*unused*/
origin = origin; /*unused*/
downcase = downcase; /*unused*/
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
result = txt_fromtext(&token.value.as_textregion, target);
if (result != DNS_R_SUCCESS)
return (result);
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
return (txt_fromtext(&token.value.as_textregion, target));
}
@ -54,7 +65,7 @@ totext_hinfo(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
isc_region_t region;
dns_result_t result;
INSIST(rdata->type == 13);
REQUIRE(rdata->type == 13);
origin = origin; /*unused*/
@ -78,7 +89,7 @@ fromwire_hinfo(dns_rdataclass_t class, dns_rdatatype_t type,
isc_boolean_t downcase, isc_buffer_t *target) {
dns_result_t result;
INSIST(type == 13);
REQUIRE(type == 13);
dctx = dctx; /* unused */
class = class; /* unused */
@ -95,7 +106,7 @@ static dns_result_t
towire_hinfo(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
isc_region_t region;
INSIST(rdata->type == 13);
REQUIRE(rdata->type == 13);
cctx = cctx;
@ -114,9 +125,9 @@ compare_hinfo(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
int l;
int result;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == 13);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == 13);
l = (rdata1->length < rdata2->length) ? rdata1->length : rdata2->length;
result = memcmp(rdata1->data, rdata2->data, l);
@ -133,7 +144,7 @@ static dns_result_t
fromstruct_hinfo(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 13);
REQUIRE(type == 13);
class = class; /*unused*/
@ -146,7 +157,7 @@ fromstruct_hinfo(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_hinfo(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 13);
REQUIRE(rdata->type == 13);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: mb_7.c,v 1.3 1999/01/19 06:49:29 marka Exp $ */
/* $Id: mb_7.c,v 1.4 1999/01/20 05:20:20 marka Exp $ */
#ifndef RDATA_GENERIC_MB_7_H
#define RDATA_GENERIC_MB_7_H
@ -27,15 +27,21 @@ fromtext_mb(dns_rdataclass_t class, dns_rdatatype_t type,
isc_token_t token;
dns_name_t name;
isc_buffer_t buffer;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 7);
REQUIRE(type == 7);
class = class; /*unused*/
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region,
@ -51,7 +57,7 @@ totext_mb(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
dns_name_t prefix;
isc_boolean_t sub;
INSIST(rdata->type == 7);
REQUIRE(rdata->type == 7);
dns_name_init(&name, NULL);
dns_name_init(&prefix, NULL);
@ -70,7 +76,7 @@ fromwire_mb(dns_rdataclass_t class, dns_rdatatype_t type,
isc_boolean_t downcase, isc_buffer_t *target) {
dns_name_t name;
INSIST(type == 7);
REQUIRE(type == 7);
class = class; /*unused*/
@ -83,7 +89,7 @@ towire_mb(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
dns_name_t name;
isc_region_t region;
INSIST(rdata->type == 7);
REQUIRE(rdata->type == 7);
dns_name_init(&name, NULL);
dns_rdata_toregion(rdata, &region);
@ -99,9 +105,9 @@ compare_mb(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
isc_region_t region1;
isc_region_t region2;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == 7);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == 7);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
@ -119,7 +125,7 @@ static dns_result_t
fromstruct_mb(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 7);
REQUIRE(type == 7);
class = class; /*unused*/
@ -132,7 +138,7 @@ fromstruct_mb(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_mb(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 7);
REQUIRE(rdata->type == 7);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: mb_7.h,v 1.3 1999/01/19 06:49:29 marka Exp $ */
/* $Id: mb_7.h,v 1.4 1999/01/20 05:20:20 marka Exp $ */
#ifndef RDATA_GENERIC_MB_7_H
#define RDATA_GENERIC_MB_7_H
@ -27,15 +27,21 @@ fromtext_mb(dns_rdataclass_t class, dns_rdatatype_t type,
isc_token_t token;
dns_name_t name;
isc_buffer_t buffer;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 7);
REQUIRE(type == 7);
class = class; /*unused*/
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region,
@ -51,7 +57,7 @@ totext_mb(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
dns_name_t prefix;
isc_boolean_t sub;
INSIST(rdata->type == 7);
REQUIRE(rdata->type == 7);
dns_name_init(&name, NULL);
dns_name_init(&prefix, NULL);
@ -70,7 +76,7 @@ fromwire_mb(dns_rdataclass_t class, dns_rdatatype_t type,
isc_boolean_t downcase, isc_buffer_t *target) {
dns_name_t name;
INSIST(type == 7);
REQUIRE(type == 7);
class = class; /*unused*/
@ -83,7 +89,7 @@ towire_mb(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
dns_name_t name;
isc_region_t region;
INSIST(rdata->type == 7);
REQUIRE(rdata->type == 7);
dns_name_init(&name, NULL);
dns_rdata_toregion(rdata, &region);
@ -99,9 +105,9 @@ compare_mb(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
isc_region_t region1;
isc_region_t region2;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == 7);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == 7);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
@ -119,7 +125,7 @@ static dns_result_t
fromstruct_mb(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 7);
REQUIRE(type == 7);
class = class; /*unused*/
@ -132,7 +138,7 @@ fromstruct_mb(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_mb(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 7);
REQUIRE(rdata->type == 7);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: md_3.c,v 1.3 1999/01/19 06:49:29 marka Exp $ */
/* $Id: md_3.c,v 1.4 1999/01/20 05:20:20 marka Exp $ */
#ifndef RDATA_GENERIC_MD_3_H
#define RDATA_GENERIC_MD_3_H
@ -28,16 +28,22 @@ fromtext_md(dns_rdataclass_t class, dns_rdatatype_t type,
isc_result_t result;
dns_name_t name;
isc_buffer_t buffer;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 3);
REQUIRE(type == 3);
class = class; /*unused*/
result = isc_lex_gettoken(lexer, 0, &token);
result = isc_lex_gettoken(lexer, options, &token);
if (result != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region,
@ -53,7 +59,7 @@ totext_md(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
dns_name_t prefix;
isc_boolean_t sub;
INSIST(rdata->type == 3);
REQUIRE(rdata->type == 3);
dns_name_init(&name, NULL);
dns_rdata_toregion(rdata, &region);
@ -70,7 +76,7 @@ fromwire_md(dns_rdataclass_t class, dns_rdatatype_t type,
isc_boolean_t downcase, isc_buffer_t *target) {
dns_name_t name;
INSIST(type == 3);
REQUIRE(type == 3);
class = class; /*unused*/
@ -83,7 +89,7 @@ towire_md(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
dns_name_t name;
isc_region_t region;
INSIST(rdata->type == 3);
REQUIRE(rdata->type == 3);
dns_name_init(&name, NULL);
dns_rdata_toregion(rdata, &region);
@ -99,9 +105,9 @@ compare_md(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
isc_region_t region1;
isc_region_t region2;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == 3);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == 3);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
@ -119,7 +125,7 @@ static dns_result_t
fromstruct_md(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 3);
REQUIRE(type == 3);
class = class; /*unused*/
@ -132,7 +138,7 @@ fromstruct_md(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_md(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 3);
REQUIRE(rdata->type == 3);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: md_3.h,v 1.3 1999/01/19 06:49:29 marka Exp $ */
/* $Id: md_3.h,v 1.4 1999/01/20 05:20:20 marka Exp $ */
#ifndef RDATA_GENERIC_MD_3_H
#define RDATA_GENERIC_MD_3_H
@ -28,16 +28,22 @@ fromtext_md(dns_rdataclass_t class, dns_rdatatype_t type,
isc_result_t result;
dns_name_t name;
isc_buffer_t buffer;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 3);
REQUIRE(type == 3);
class = class; /*unused*/
result = isc_lex_gettoken(lexer, 0, &token);
result = isc_lex_gettoken(lexer, options, &token);
if (result != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region,
@ -53,7 +59,7 @@ totext_md(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
dns_name_t prefix;
isc_boolean_t sub;
INSIST(rdata->type == 3);
REQUIRE(rdata->type == 3);
dns_name_init(&name, NULL);
dns_rdata_toregion(rdata, &region);
@ -70,7 +76,7 @@ fromwire_md(dns_rdataclass_t class, dns_rdatatype_t type,
isc_boolean_t downcase, isc_buffer_t *target) {
dns_name_t name;
INSIST(type == 3);
REQUIRE(type == 3);
class = class; /*unused*/
@ -83,7 +89,7 @@ towire_md(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
dns_name_t name;
isc_region_t region;
INSIST(rdata->type == 3);
REQUIRE(rdata->type == 3);
dns_name_init(&name, NULL);
dns_rdata_toregion(rdata, &region);
@ -99,9 +105,9 @@ compare_md(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
isc_region_t region1;
isc_region_t region2;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == 3);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == 3);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
@ -119,7 +125,7 @@ static dns_result_t
fromstruct_md(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 3);
REQUIRE(type == 3);
class = class; /*unused*/
@ -132,7 +138,7 @@ fromstruct_md(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_md(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 3);
REQUIRE(rdata->type == 3);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: mf_4.c,v 1.3 1999/01/19 06:49:30 marka Exp $ */
/* $Id: mf_4.c,v 1.4 1999/01/20 05:20:20 marka Exp $ */
#ifndef RDATA_GENERIC_MF_4_H
#define RDATA_GENERIC_MF_4_H
@ -25,19 +25,23 @@ fromtext_mf(dns_rdataclass_t class, dns_rdatatype_t type,
isc_lex_t *lexer, dns_name_t *origin,
isc_boolean_t downcase, isc_buffer_t *target) {
isc_token_t token;
isc_result_t result;
dns_name_t name;
isc_buffer_t buffer;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 4);
REQUIRE(type == 4);
class = class; /*unused*/
result = isc_lex_gettoken(lexer, 0, &token);
if (result != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region,
@ -53,7 +57,7 @@ totext_mf(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
dns_name_t prefix;
isc_boolean_t sub;
INSIST(rdata->type == 4);
REQUIRE(rdata->type == 4);
dns_name_init(&name, NULL);
dns_rdata_toregion(rdata, &region);
@ -70,7 +74,7 @@ fromwire_mf(dns_rdataclass_t class, dns_rdatatype_t type,
isc_boolean_t downcase, isc_buffer_t *target) {
dns_name_t name;
INSIST(type == 4);
REQUIRE(type == 4);
class = class; /*unused*/
@ -83,7 +87,7 @@ towire_mf(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
dns_name_t name;
isc_region_t region;
INSIST(rdata->type == 4);
REQUIRE(rdata->type == 4);
dns_name_init(&name, NULL);
dns_rdata_toregion(rdata, &region);
@ -99,9 +103,9 @@ compare_mf(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
isc_region_t region1;
isc_region_t region2;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == 4);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == 4);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
@ -119,7 +123,7 @@ static dns_result_t
fromstruct_mf(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 4);
REQUIRE(type == 4);
class = class; /*unused*/
@ -132,7 +136,7 @@ fromstruct_mf(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_mf(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 4);
REQUIRE(rdata->type == 4);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: mf_4.h,v 1.3 1999/01/19 06:49:30 marka Exp $ */
/* $Id: mf_4.h,v 1.4 1999/01/20 05:20:20 marka Exp $ */
#ifndef RDATA_GENERIC_MF_4_H
#define RDATA_GENERIC_MF_4_H
@ -25,19 +25,23 @@ fromtext_mf(dns_rdataclass_t class, dns_rdatatype_t type,
isc_lex_t *lexer, dns_name_t *origin,
isc_boolean_t downcase, isc_buffer_t *target) {
isc_token_t token;
isc_result_t result;
dns_name_t name;
isc_buffer_t buffer;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 4);
REQUIRE(type == 4);
class = class; /*unused*/
result = isc_lex_gettoken(lexer, 0, &token);
if (result != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region,
@ -53,7 +57,7 @@ totext_mf(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
dns_name_t prefix;
isc_boolean_t sub;
INSIST(rdata->type == 4);
REQUIRE(rdata->type == 4);
dns_name_init(&name, NULL);
dns_rdata_toregion(rdata, &region);
@ -70,7 +74,7 @@ fromwire_mf(dns_rdataclass_t class, dns_rdatatype_t type,
isc_boolean_t downcase, isc_buffer_t *target) {
dns_name_t name;
INSIST(type == 4);
REQUIRE(type == 4);
class = class; /*unused*/
@ -83,7 +87,7 @@ towire_mf(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
dns_name_t name;
isc_region_t region;
INSIST(rdata->type == 4);
REQUIRE(rdata->type == 4);
dns_name_init(&name, NULL);
dns_rdata_toregion(rdata, &region);
@ -99,9 +103,9 @@ compare_mf(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
isc_region_t region1;
isc_region_t region2;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == 4);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == 4);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
@ -119,7 +123,7 @@ static dns_result_t
fromstruct_mf(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 4);
REQUIRE(type == 4);
class = class; /*unused*/
@ -132,7 +136,7 @@ fromstruct_mf(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_mf(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 4);
REQUIRE(rdata->type == 4);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: mg_8.c,v 1.3 1999/01/19 06:49:30 marka Exp $ */
/* $Id: mg_8.c,v 1.4 1999/01/20 05:20:21 marka Exp $ */
#ifndef RDATA_GENERIC_MG_8_H
#define RDATA_GENERIC_MG_8_H
@ -25,19 +25,23 @@ fromtext_mg(dns_rdataclass_t class, dns_rdatatype_t type,
isc_lex_t *lexer, dns_name_t *origin,
isc_boolean_t downcase, isc_buffer_t *target) {
isc_token_t token;
isc_result_t result;
dns_name_t name;
isc_buffer_t buffer;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 8);
REQUIRE(type == 8);
class = class; /*unused*/
result = isc_lex_gettoken(lexer, 0, &token);
if (result != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region,
@ -53,7 +57,7 @@ totext_mg(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
dns_name_t prefix;
isc_boolean_t sub;
INSIST(rdata->type == 8);
REQUIRE(rdata->type == 8);
dns_name_init(&name, NULL);
dns_name_init(&prefix, NULL);
@ -72,7 +76,7 @@ fromwire_mg(dns_rdataclass_t class, dns_rdatatype_t type,
isc_boolean_t downcase, isc_buffer_t *target) {
dns_name_t name;
INSIST(type == 8);
REQUIRE(type == 8);
class = class; /*unused*/
@ -85,7 +89,7 @@ towire_mg(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
dns_name_t name;
isc_region_t region;
INSIST(rdata->type == 8);
REQUIRE(rdata->type == 8);
dns_name_init(&name, NULL);
dns_rdata_toregion(rdata, &region);
@ -101,9 +105,9 @@ compare_mg(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
isc_region_t region1;
isc_region_t region2;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == 8);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == 8);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
@ -121,7 +125,7 @@ static dns_result_t
fromstruct_mg(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 8);
REQUIRE(type == 8);
class = class; /*unused*/
@ -134,7 +138,7 @@ fromstruct_mg(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_mg(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 8);
REQUIRE(rdata->type == 8);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: mg_8.h,v 1.3 1999/01/19 06:49:30 marka Exp $ */
/* $Id: mg_8.h,v 1.4 1999/01/20 05:20:21 marka Exp $ */
#ifndef RDATA_GENERIC_MG_8_H
#define RDATA_GENERIC_MG_8_H
@ -25,19 +25,23 @@ fromtext_mg(dns_rdataclass_t class, dns_rdatatype_t type,
isc_lex_t *lexer, dns_name_t *origin,
isc_boolean_t downcase, isc_buffer_t *target) {
isc_token_t token;
isc_result_t result;
dns_name_t name;
isc_buffer_t buffer;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 8);
REQUIRE(type == 8);
class = class; /*unused*/
result = isc_lex_gettoken(lexer, 0, &token);
if (result != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region,
@ -53,7 +57,7 @@ totext_mg(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
dns_name_t prefix;
isc_boolean_t sub;
INSIST(rdata->type == 8);
REQUIRE(rdata->type == 8);
dns_name_init(&name, NULL);
dns_name_init(&prefix, NULL);
@ -72,7 +76,7 @@ fromwire_mg(dns_rdataclass_t class, dns_rdatatype_t type,
isc_boolean_t downcase, isc_buffer_t *target) {
dns_name_t name;
INSIST(type == 8);
REQUIRE(type == 8);
class = class; /*unused*/
@ -85,7 +89,7 @@ towire_mg(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
dns_name_t name;
isc_region_t region;
INSIST(rdata->type == 8);
REQUIRE(rdata->type == 8);
dns_name_init(&name, NULL);
dns_rdata_toregion(rdata, &region);
@ -101,9 +105,9 @@ compare_mg(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
isc_region_t region1;
isc_region_t region2;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == 8);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == 8);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
@ -121,7 +125,7 @@ static dns_result_t
fromstruct_mg(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 8);
REQUIRE(type == 8);
class = class; /*unused*/
@ -134,7 +138,7 @@ fromstruct_mg(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_mg(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 8);
REQUIRE(rdata->type == 8);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: minfo_14.c,v 1.3 1999/01/19 06:49:30 marka Exp $ */
/* $Id: minfo_14.c,v 1.4 1999/01/20 05:20:21 marka Exp $ */
#ifndef RDATA_GENERIC_MINFO_14_H
#define RDATA_GENERIC_MINFO_14_H
@ -28,15 +28,21 @@ fromtext_minfo(dns_rdataclass_t class, dns_rdatatype_t type,
dns_result_t result;
dns_name_t name;
isc_buffer_t buffer;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 14);
REQUIRE(type == 14);
class = class; /*unused*/
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region,
@ -46,10 +52,15 @@ fromtext_minfo(dns_rdataclass_t class, dns_rdatatype_t type,
if (result != DNS_R_SUCCESS)
return (result);
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
return (DNS_R_UNEXPECTED);
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region,
@ -67,7 +78,7 @@ totext_minfo(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
dns_result_t result;
isc_boolean_t sub;
INSIST(rdata->type == 14);
REQUIRE(rdata->type == 14);
dns_name_init(&rmail, NULL);
dns_name_init(&email, NULL);
@ -107,7 +118,7 @@ fromwire_minfo(dns_rdataclass_t class, dns_rdatatype_t type,
dns_name_t email;
dns_result_t result;
INSIST(type == 14);
REQUIRE(type == 14);
class = class; /*unused*/
@ -128,7 +139,7 @@ towire_minfo(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
dns_name_t email;
dns_result_t result;
INSIST(rdata->type == 14);
REQUIRE(rdata->type == 14);
dns_name_init(&rmail, NULL);
dns_name_init(&email, NULL);
@ -158,9 +169,9 @@ compare_minfo(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
dns_name_t name2;
int result;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == 14);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == 14);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
@ -192,7 +203,7 @@ static dns_result_t
fromstruct_minfo(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 14);
REQUIRE(type == 14);
class = class; /*unused*/
@ -205,7 +216,7 @@ fromstruct_minfo(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_minfo(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 14);
REQUIRE(rdata->type == 14);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: minfo_14.h,v 1.3 1999/01/19 06:49:30 marka Exp $ */
/* $Id: minfo_14.h,v 1.4 1999/01/20 05:20:21 marka Exp $ */
#ifndef RDATA_GENERIC_MINFO_14_H
#define RDATA_GENERIC_MINFO_14_H
@ -28,15 +28,21 @@ fromtext_minfo(dns_rdataclass_t class, dns_rdatatype_t type,
dns_result_t result;
dns_name_t name;
isc_buffer_t buffer;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 14);
REQUIRE(type == 14);
class = class; /*unused*/
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region,
@ -46,10 +52,15 @@ fromtext_minfo(dns_rdataclass_t class, dns_rdatatype_t type,
if (result != DNS_R_SUCCESS)
return (result);
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
return (DNS_R_UNEXPECTED);
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region,
@ -67,7 +78,7 @@ totext_minfo(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
dns_result_t result;
isc_boolean_t sub;
INSIST(rdata->type == 14);
REQUIRE(rdata->type == 14);
dns_name_init(&rmail, NULL);
dns_name_init(&email, NULL);
@ -107,7 +118,7 @@ fromwire_minfo(dns_rdataclass_t class, dns_rdatatype_t type,
dns_name_t email;
dns_result_t result;
INSIST(type == 14);
REQUIRE(type == 14);
class = class; /*unused*/
@ -128,7 +139,7 @@ towire_minfo(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
dns_name_t email;
dns_result_t result;
INSIST(rdata->type == 14);
REQUIRE(rdata->type == 14);
dns_name_init(&rmail, NULL);
dns_name_init(&email, NULL);
@ -158,9 +169,9 @@ compare_minfo(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
dns_name_t name2;
int result;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == 14);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == 14);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
@ -192,7 +203,7 @@ static dns_result_t
fromstruct_minfo(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 14);
REQUIRE(type == 14);
class = class; /*unused*/
@ -205,7 +216,7 @@ fromstruct_minfo(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_minfo(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 14);
REQUIRE(rdata->type == 14);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: mr_9.c,v 1.3 1999/01/19 06:49:31 marka Exp $ */
/* $Id: mr_9.c,v 1.4 1999/01/20 05:20:21 marka Exp $ */
#ifndef RDATA_GENERIC_MR_9_H
#define RDATA_GENERIC_MR_9_H
@ -27,15 +27,21 @@ fromtext_mr(dns_rdataclass_t class, dns_rdatatype_t type,
isc_token_t token;
dns_name_t name;
isc_buffer_t buffer;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 9);
REQUIRE(type == 9);
class = class; /*unused*/
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region,
@ -51,7 +57,7 @@ totext_mr(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
dns_name_t prefix;
isc_boolean_t sub;
INSIST(rdata->type == 9);
REQUIRE(rdata->type == 9);
dns_name_init(&name, NULL);
dns_name_init(&prefix, NULL);
@ -70,7 +76,7 @@ fromwire_mr(dns_rdataclass_t class, dns_rdatatype_t type,
isc_boolean_t downcase, isc_buffer_t *target) {
dns_name_t name;
INSIST(type == 9);
REQUIRE(type == 9);
class = class; /*unused*/
@ -83,7 +89,7 @@ towire_mr(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
dns_name_t name;
isc_region_t region;
INSIST(rdata->type == 9);
REQUIRE(rdata->type == 9);
dns_name_init(&name, NULL);
dns_rdata_toregion(rdata, &region);
@ -99,9 +105,9 @@ compare_mr(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
isc_region_t region1;
isc_region_t region2;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == 9);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == 9);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
@ -119,7 +125,7 @@ static dns_result_t
fromstruct_mr(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 9);
REQUIRE(type == 9);
class = class; /*unused*/
@ -132,7 +138,7 @@ fromstruct_mr(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_mr(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 9);
REQUIRE(rdata->type == 9);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: mr_9.h,v 1.3 1999/01/19 06:49:31 marka Exp $ */
/* $Id: mr_9.h,v 1.4 1999/01/20 05:20:21 marka Exp $ */
#ifndef RDATA_GENERIC_MR_9_H
#define RDATA_GENERIC_MR_9_H
@ -27,15 +27,21 @@ fromtext_mr(dns_rdataclass_t class, dns_rdatatype_t type,
isc_token_t token;
dns_name_t name;
isc_buffer_t buffer;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 9);
REQUIRE(type == 9);
class = class; /*unused*/
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region,
@ -51,7 +57,7 @@ totext_mr(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
dns_name_t prefix;
isc_boolean_t sub;
INSIST(rdata->type == 9);
REQUIRE(rdata->type == 9);
dns_name_init(&name, NULL);
dns_name_init(&prefix, NULL);
@ -70,7 +76,7 @@ fromwire_mr(dns_rdataclass_t class, dns_rdatatype_t type,
isc_boolean_t downcase, isc_buffer_t *target) {
dns_name_t name;
INSIST(type == 9);
REQUIRE(type == 9);
class = class; /*unused*/
@ -83,7 +89,7 @@ towire_mr(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
dns_name_t name;
isc_region_t region;
INSIST(rdata->type == 9);
REQUIRE(rdata->type == 9);
dns_name_init(&name, NULL);
dns_rdata_toregion(rdata, &region);
@ -99,9 +105,9 @@ compare_mr(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
isc_region_t region1;
isc_region_t region2;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == 9);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == 9);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
@ -119,7 +125,7 @@ static dns_result_t
fromstruct_mr(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 9);
REQUIRE(type == 9);
class = class; /*unused*/
@ -132,7 +138,7 @@ fromstruct_mr(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_mr(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 9);
REQUIRE(rdata->type == 9);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: mx_15.c,v 1.5 1999/01/20 02:41:10 halley Exp $ */
/* $Id: mx_15.c,v 1.6 1999/01/20 05:20:22 marka Exp $ */
#ifndef RDATA_GENERIC_MX_15_H
#define RDATA_GENERIC_MX_15_H
@ -28,24 +28,37 @@ fromtext_mx(dns_rdataclass_t class, dns_rdatatype_t type,
dns_name_t name;
isc_buffer_t buffer;
dns_result_t result;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 15);
REQUIRE(type == 15);
class = class; /*unused*/
if (isc_lex_gettoken(lexer, ISC_LEXOPT_NUMBER, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_number)
return (DNS_R_UNKNOWN);
options |= ISC_LEXOPT_NUMBER;
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_number) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
result = uint16_fromtext(token.value.as_ulong, target);
if (result != DNS_R_SUCCESS)
return (result);
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
options &= ~ISC_LEXOPT_NUMBER;
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region,
@ -64,7 +77,7 @@ totext_mx(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
char buf[sizeof "64000"];
unsigned short num;
INSIST(rdata->type == 15);
REQUIRE(rdata->type == 15);
dns_name_init(&name, NULL);
dns_name_init(&prefix, NULL);
@ -94,7 +107,7 @@ fromwire_mx(dns_rdataclass_t class, dns_rdatatype_t type,
isc_region_t sregion;
isc_region_t tregion;
INSIST(type == 15);
REQUIRE(type == 15);
class = class; /* unused */
dns_name_init(&name, NULL);
@ -104,7 +117,7 @@ fromwire_mx(dns_rdataclass_t class, dns_rdatatype_t type,
if (tregion.length < 2)
return (DNS_R_NOSPACE);
if (sregion.length < 2)
return (DNS_R_WIRE);
return (DNS_R_UNEXPECTEDEND);
memcpy(tregion.base, sregion.base, 2);
isc_buffer_forward(source, 2);
isc_buffer_add(target, 2);
@ -118,7 +131,7 @@ towire_mx(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
dns_result_t result;
isc_region_t tr;
INSIST(rdata->type == 15);
REQUIRE(rdata->type == 15);
isc_buffer_available(target, &tr);
dns_rdata_toregion(rdata, &region);
@ -143,9 +156,9 @@ compare_mx(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
isc_region_t region2;
int result;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == 15);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == 15);
result = memcmp(rdata1->data, rdata2->data, 2);
if (result != 0)
@ -170,7 +183,7 @@ static dns_result_t
fromstruct_mx(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 15);
REQUIRE(type == 15);
class = class; /*unused*/
@ -183,7 +196,7 @@ fromstruct_mx(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_mx(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 15);
REQUIRE(rdata->type == 15);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: mx_15.h,v 1.5 1999/01/20 02:41:10 halley Exp $ */
/* $Id: mx_15.h,v 1.6 1999/01/20 05:20:22 marka Exp $ */
#ifndef RDATA_GENERIC_MX_15_H
#define RDATA_GENERIC_MX_15_H
@ -28,24 +28,37 @@ fromtext_mx(dns_rdataclass_t class, dns_rdatatype_t type,
dns_name_t name;
isc_buffer_t buffer;
dns_result_t result;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 15);
REQUIRE(type == 15);
class = class; /*unused*/
if (isc_lex_gettoken(lexer, ISC_LEXOPT_NUMBER, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_number)
return (DNS_R_UNKNOWN);
options |= ISC_LEXOPT_NUMBER;
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_number) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
result = uint16_fromtext(token.value.as_ulong, target);
if (result != DNS_R_SUCCESS)
return (result);
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
options &= ~ISC_LEXOPT_NUMBER;
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region,
@ -64,7 +77,7 @@ totext_mx(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
char buf[sizeof "64000"];
unsigned short num;
INSIST(rdata->type == 15);
REQUIRE(rdata->type == 15);
dns_name_init(&name, NULL);
dns_name_init(&prefix, NULL);
@ -94,7 +107,7 @@ fromwire_mx(dns_rdataclass_t class, dns_rdatatype_t type,
isc_region_t sregion;
isc_region_t tregion;
INSIST(type == 15);
REQUIRE(type == 15);
class = class; /* unused */
dns_name_init(&name, NULL);
@ -104,7 +117,7 @@ fromwire_mx(dns_rdataclass_t class, dns_rdatatype_t type,
if (tregion.length < 2)
return (DNS_R_NOSPACE);
if (sregion.length < 2)
return (DNS_R_WIRE);
return (DNS_R_UNEXPECTEDEND);
memcpy(tregion.base, sregion.base, 2);
isc_buffer_forward(source, 2);
isc_buffer_add(target, 2);
@ -118,7 +131,7 @@ towire_mx(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
dns_result_t result;
isc_region_t tr;
INSIST(rdata->type == 15);
REQUIRE(rdata->type == 15);
isc_buffer_available(target, &tr);
dns_rdata_toregion(rdata, &region);
@ -143,9 +156,9 @@ compare_mx(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
isc_region_t region2;
int result;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == 15);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == 15);
result = memcmp(rdata1->data, rdata2->data, 2);
if (result != 0)
@ -170,7 +183,7 @@ static dns_result_t
fromstruct_mx(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 15);
REQUIRE(type == 15);
class = class; /*unused*/
@ -183,7 +196,7 @@ fromstruct_mx(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_mx(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 15);
REQUIRE(rdata->type == 15);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: ns_2.c,v 1.3 1999/01/19 06:49:31 marka Exp $ */
/* $Id: ns_2.c,v 1.4 1999/01/20 05:20:22 marka Exp $ */
#ifndef RDATA_GENERIC_NS_2_H
#define RDATA_GENERIC_NS_2_H
@ -27,15 +27,21 @@ fromtext_ns(dns_rdataclass_t class, dns_rdatatype_t type,
isc_token_t token;
dns_name_t name;
isc_buffer_t buffer;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 2);
REQUIRE(type == 2);
class = class; /*unused*/
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region,
@ -51,7 +57,7 @@ totext_ns(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
dns_name_t prefix;
isc_boolean_t sub;
INSIST(rdata->type == 2);
REQUIRE(rdata->type == 2);
dns_name_init(&name, NULL);
dns_name_init(&prefix, NULL);
@ -70,7 +76,7 @@ fromwire_ns(dns_rdataclass_t class, dns_rdatatype_t type,
isc_boolean_t downcase, isc_buffer_t *target) {
dns_name_t name;
INSIST(type == 2);
REQUIRE(type == 2);
class = class; /*unused*/
@ -83,7 +89,7 @@ towire_ns(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
dns_name_t name;
isc_region_t region;
INSIST(rdata->type == 2);
REQUIRE(rdata->type == 2);
dns_name_init(&name, NULL);
dns_rdata_toregion(rdata, &region);
@ -99,9 +105,9 @@ compare_ns(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
isc_region_t region1;
isc_region_t region2;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == 2);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == 2);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
@ -119,7 +125,7 @@ static dns_result_t
fromstruct_ns(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 2);
REQUIRE(type == 2);
class = class; /*unused*/
@ -132,7 +138,7 @@ fromstruct_ns(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_ns(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 2);
REQUIRE(rdata->type == 2);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: ns_2.h,v 1.3 1999/01/19 06:49:31 marka Exp $ */
/* $Id: ns_2.h,v 1.4 1999/01/20 05:20:22 marka Exp $ */
#ifndef RDATA_GENERIC_NS_2_H
#define RDATA_GENERIC_NS_2_H
@ -27,15 +27,21 @@ fromtext_ns(dns_rdataclass_t class, dns_rdatatype_t type,
isc_token_t token;
dns_name_t name;
isc_buffer_t buffer;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 2);
REQUIRE(type == 2);
class = class; /*unused*/
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region,
@ -51,7 +57,7 @@ totext_ns(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
dns_name_t prefix;
isc_boolean_t sub;
INSIST(rdata->type == 2);
REQUIRE(rdata->type == 2);
dns_name_init(&name, NULL);
dns_name_init(&prefix, NULL);
@ -70,7 +76,7 @@ fromwire_ns(dns_rdataclass_t class, dns_rdatatype_t type,
isc_boolean_t downcase, isc_buffer_t *target) {
dns_name_t name;
INSIST(type == 2);
REQUIRE(type == 2);
class = class; /*unused*/
@ -83,7 +89,7 @@ towire_ns(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
dns_name_t name;
isc_region_t region;
INSIST(rdata->type == 2);
REQUIRE(rdata->type == 2);
dns_name_init(&name, NULL);
dns_rdata_toregion(rdata, &region);
@ -99,9 +105,9 @@ compare_ns(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
isc_region_t region1;
isc_region_t region2;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == 2);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == 2);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
@ -119,7 +125,7 @@ static dns_result_t
fromstruct_ns(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 2);
REQUIRE(type == 2);
class = class; /*unused*/
@ -132,7 +138,7 @@ fromstruct_ns(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_ns(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 2);
REQUIRE(rdata->type == 2);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: null_10.c,v 1.3 1999/01/19 06:49:31 marka Exp $ */
/* $Id: null_10.c,v 1.4 1999/01/20 05:20:22 marka Exp $ */
#ifndef RDATA_GENERIC_NULL_10_H
#define RDATA_GENERIC_NULL_10_H
@ -25,7 +25,7 @@ fromtext_null(dns_rdataclass_t class, dns_rdatatype_t type,
isc_lex_t *lexer, dns_name_t *origin,
isc_boolean_t downcase, isc_buffer_t *target) {
INSIST(type == 10);
REQUIRE(type == 10);
class = class; /*unused*/
type = type; /*unused*/
@ -41,8 +41,8 @@ static dns_result_t
totext_null(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
INSIST(rdata->type == 10);
INSIST(rdata->length == 0);
REQUIRE(rdata->type == 10);
REQUIRE(rdata->length == 0);
origin = origin; /*unused*/
target = target; /*unused*/
@ -55,7 +55,7 @@ fromwire_null(dns_rdataclass_t class, dns_rdatatype_t type,
isc_buffer_t *source, dns_decompress_t *dctx,
isc_boolean_t downcase, isc_buffer_t *target) {
INSIST(type == 10);
REQUIRE(type == 10);
class = class; /*unused*/
dctx = dctx; /*unused*/
@ -69,7 +69,7 @@ fromwire_null(dns_rdataclass_t class, dns_rdatatype_t type,
static dns_result_t
towire_null(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
INSIST(rdata->type == 10);
REQUIRE(rdata->type == 10);
cctx = cctx; /*unused*/
target = target; /*unused*/
@ -80,9 +80,9 @@ towire_null(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
static int
compare_null(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
INSIST(rdata1->type == rdata1->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == 10);
REQUIRE(rdata1->type == rdata1->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == 10);
return (0);
}
@ -91,7 +91,7 @@ static dns_result_t
fromstruct_null(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 10);
REQUIRE(type == 10);
class = class; /*unused*/
@ -104,7 +104,7 @@ fromstruct_null(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_null(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 10);
REQUIRE(rdata->type == 10);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: null_10.h,v 1.3 1999/01/19 06:49:31 marka Exp $ */
/* $Id: null_10.h,v 1.4 1999/01/20 05:20:22 marka Exp $ */
#ifndef RDATA_GENERIC_NULL_10_H
#define RDATA_GENERIC_NULL_10_H
@ -25,7 +25,7 @@ fromtext_null(dns_rdataclass_t class, dns_rdatatype_t type,
isc_lex_t *lexer, dns_name_t *origin,
isc_boolean_t downcase, isc_buffer_t *target) {
INSIST(type == 10);
REQUIRE(type == 10);
class = class; /*unused*/
type = type; /*unused*/
@ -41,8 +41,8 @@ static dns_result_t
totext_null(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
INSIST(rdata->type == 10);
INSIST(rdata->length == 0);
REQUIRE(rdata->type == 10);
REQUIRE(rdata->length == 0);
origin = origin; /*unused*/
target = target; /*unused*/
@ -55,7 +55,7 @@ fromwire_null(dns_rdataclass_t class, dns_rdatatype_t type,
isc_buffer_t *source, dns_decompress_t *dctx,
isc_boolean_t downcase, isc_buffer_t *target) {
INSIST(type == 10);
REQUIRE(type == 10);
class = class; /*unused*/
dctx = dctx; /*unused*/
@ -69,7 +69,7 @@ fromwire_null(dns_rdataclass_t class, dns_rdatatype_t type,
static dns_result_t
towire_null(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
INSIST(rdata->type == 10);
REQUIRE(rdata->type == 10);
cctx = cctx; /*unused*/
target = target; /*unused*/
@ -80,9 +80,9 @@ towire_null(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
static int
compare_null(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
INSIST(rdata1->type == rdata1->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == 10);
REQUIRE(rdata1->type == rdata1->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == 10);
return (0);
}
@ -91,7 +91,7 @@ static dns_result_t
fromstruct_null(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 10);
REQUIRE(type == 10);
class = class; /*unused*/
@ -104,7 +104,7 @@ fromstruct_null(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_null(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 10);
REQUIRE(rdata->type == 10);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: proforma.c,v 1.3 1999/01/19 06:49:32 marka Exp $ */
/* $Id: proforma.c,v 1.4 1999/01/20 05:20:23 marka Exp $ */
#ifndef RDATA_GENERIC_#_#_H
#define RDATA_GENERIC_#_#_H
@ -24,9 +24,10 @@ static dns_result_t
fromtext_#(dns_rdataclass_t class, dns_rdatatype_t type,
isc_lex_t *lexer, dns_name_t *origin,
isc_boolean_t downcase, isc_buffer_t *target) {
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == #);
INSIST(class == #);
REQUIRE(type == #);
REQUIRE(class == #);
return (DNS_R_NOTIMPLEMENTED);
}
@ -34,8 +35,8 @@ fromtext_#(dns_rdataclass_t class, dns_rdatatype_t type,
static dns_result_t
totext_#(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
INSIST(rdata->type == #);
INSIST(rdata->class == #);
REQUIRE(rdata->type == #);
REQUIRE(rdata->class == #);
return (DNS_R_NOTIMPLEMENTED);
}
@ -45,8 +46,8 @@ fromwire_#(dns_rdataclass_t class, dns_rdatatype_t type,
isc_buffer_t *source, dns_decompress_t *dctx,
isc_boolean_t downcase, isc_buffer_t *target) {
INSIST(type == #);
INSIST(class == #);
REQUIRE(type == #);
REQUIRE(class == #);
return (DNS_R_NOTIMPLEMENTED);
}
@ -54,8 +55,8 @@ fromwire_#(dns_rdataclass_t class, dns_rdatatype_t type,
static dns_result_t
towire_#(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
INSIST(rdata->type == #);
INSIST(rdata->class == #);
REQUIRE(rdata->type == #);
REQUIRE(rdata->class == #);
return (DNS_R_NOTIMPLEMENTED);
}
@ -63,10 +64,10 @@ towire_#(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
static int
compare_#(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == #);
INSIST(rdata1->class == #);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == #);
REQUIRE(rdata1->class == #);
return (-2);
}
@ -75,8 +76,8 @@ static dns_result_t
fromstruct_#(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == #);
INSIST(class == #);
REQUIRE(type == #);
REQUIRE(class == #);
return (DNS_R_NOTIMPLEMENTED);
}
@ -84,8 +85,8 @@ fromstruct_#(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_#(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == #);
INSIST(rdata->class == #);
REQUIRE(rdata->type == #);
REQUIRE(rdata->class == #);
return (DNS_R_NOTIMPLEMENTED);
}

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: proforma.h,v 1.3 1999/01/19 06:49:32 marka Exp $ */
/* $Id: proforma.h,v 1.4 1999/01/20 05:20:23 marka Exp $ */
#ifndef RDATA_GENERIC_#_#_H
#define RDATA_GENERIC_#_#_H
@ -24,9 +24,10 @@ static dns_result_t
fromtext_#(dns_rdataclass_t class, dns_rdatatype_t type,
isc_lex_t *lexer, dns_name_t *origin,
isc_boolean_t downcase, isc_buffer_t *target) {
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == #);
INSIST(class == #);
REQUIRE(type == #);
REQUIRE(class == #);
return (DNS_R_NOTIMPLEMENTED);
}
@ -34,8 +35,8 @@ fromtext_#(dns_rdataclass_t class, dns_rdatatype_t type,
static dns_result_t
totext_#(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
INSIST(rdata->type == #);
INSIST(rdata->class == #);
REQUIRE(rdata->type == #);
REQUIRE(rdata->class == #);
return (DNS_R_NOTIMPLEMENTED);
}
@ -45,8 +46,8 @@ fromwire_#(dns_rdataclass_t class, dns_rdatatype_t type,
isc_buffer_t *source, dns_decompress_t *dctx,
isc_boolean_t downcase, isc_buffer_t *target) {
INSIST(type == #);
INSIST(class == #);
REQUIRE(type == #);
REQUIRE(class == #);
return (DNS_R_NOTIMPLEMENTED);
}
@ -54,8 +55,8 @@ fromwire_#(dns_rdataclass_t class, dns_rdatatype_t type,
static dns_result_t
towire_#(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
INSIST(rdata->type == #);
INSIST(rdata->class == #);
REQUIRE(rdata->type == #);
REQUIRE(rdata->class == #);
return (DNS_R_NOTIMPLEMENTED);
}
@ -63,10 +64,10 @@ towire_#(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
static int
compare_#(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == #);
INSIST(rdata1->class == #);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == #);
REQUIRE(rdata1->class == #);
return (-2);
}
@ -75,8 +76,8 @@ static dns_result_t
fromstruct_#(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == #);
INSIST(class == #);
REQUIRE(type == #);
REQUIRE(class == #);
return (DNS_R_NOTIMPLEMENTED);
}
@ -84,8 +85,8 @@ fromstruct_#(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_#(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == #);
INSIST(rdata->class == #);
REQUIRE(rdata->type == #);
REQUIRE(rdata->class == #);
return (DNS_R_NOTIMPLEMENTED);
}

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: ptr_12.c,v 1.3 1999/01/19 06:49:32 marka Exp $ */
/* $Id: ptr_12.c,v 1.4 1999/01/20 05:20:23 marka Exp $ */
#ifndef RDATA_GENERIC_PTR_12_H
#define RDATA_GENERIC_PTR_12_H
@ -27,15 +27,21 @@ fromtext_ptr(dns_rdataclass_t class, dns_rdatatype_t type,
isc_token_t token;
dns_name_t name;
isc_buffer_t buffer;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 12);
REQUIRE(type == 12);
class = class; /*unused*/
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region,
@ -51,7 +57,7 @@ totext_ptr(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
dns_name_t prefix;
isc_boolean_t sub;
INSIST(rdata->type == 12);
REQUIRE(rdata->type == 12);
dns_name_init(&name, NULL);
dns_name_init(&prefix, NULL);
@ -70,7 +76,7 @@ fromwire_ptr(dns_rdataclass_t class, dns_rdatatype_t type,
isc_boolean_t downcase, isc_buffer_t *target) {
dns_name_t name;
INSIST(type == 12);
REQUIRE(type == 12);
class = class; /* unused */
@ -83,7 +89,7 @@ towire_ptr(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
dns_name_t name;
isc_region_t region;
INSIST(rdata->type == 12);
REQUIRE(rdata->type == 12);
dns_name_init(&name, NULL);
dns_rdata_toregion(rdata, &region);
@ -99,9 +105,9 @@ compare_ptr(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
isc_region_t region1;
isc_region_t region2;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == 12);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == 12);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
@ -119,7 +125,7 @@ static dns_result_t
fromstruct_ptr(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 12);
REQUIRE(type == 12);
class = class; /*unused*/
@ -132,7 +138,7 @@ fromstruct_ptr(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_ptr(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 12);
REQUIRE(rdata->type == 12);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: ptr_12.h,v 1.3 1999/01/19 06:49:32 marka Exp $ */
/* $Id: ptr_12.h,v 1.4 1999/01/20 05:20:23 marka Exp $ */
#ifndef RDATA_GENERIC_PTR_12_H
#define RDATA_GENERIC_PTR_12_H
@ -27,15 +27,21 @@ fromtext_ptr(dns_rdataclass_t class, dns_rdatatype_t type,
isc_token_t token;
dns_name_t name;
isc_buffer_t buffer;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 12);
REQUIRE(type == 12);
class = class; /*unused*/
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region,
@ -51,7 +57,7 @@ totext_ptr(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
dns_name_t prefix;
isc_boolean_t sub;
INSIST(rdata->type == 12);
REQUIRE(rdata->type == 12);
dns_name_init(&name, NULL);
dns_name_init(&prefix, NULL);
@ -70,7 +76,7 @@ fromwire_ptr(dns_rdataclass_t class, dns_rdatatype_t type,
isc_boolean_t downcase, isc_buffer_t *target) {
dns_name_t name;
INSIST(type == 12);
REQUIRE(type == 12);
class = class; /* unused */
@ -83,7 +89,7 @@ towire_ptr(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
dns_name_t name;
isc_region_t region;
INSIST(rdata->type == 12);
REQUIRE(rdata->type == 12);
dns_name_init(&name, NULL);
dns_rdata_toregion(rdata, &region);
@ -99,9 +105,9 @@ compare_ptr(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
isc_region_t region1;
isc_region_t region2;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == 12);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == 12);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
@ -119,7 +125,7 @@ static dns_result_t
fromstruct_ptr(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 12);
REQUIRE(type == 12);
class = class; /*unused*/
@ -132,7 +138,7 @@ fromstruct_ptr(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_ptr(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 12);
REQUIRE(rdata->type == 12);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: soa_6.c,v 1.5 1999/01/20 02:41:11 halley Exp $ */
/* $Id: soa_6.c,v 1.6 1999/01/20 05:20:23 marka Exp $ */
#ifndef RDATA_GENERIC_SOA_6_H
#define RDATA_GENERIC_SOA_6_H
@ -29,15 +29,21 @@ fromtext_soa(dns_rdataclass_t class, dns_rdatatype_t type,
isc_buffer_t buffer;
dns_result_t result;
int i;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 6);
REQUIRE(type == 6);
class = class; /*unused*/
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region,
@ -47,10 +53,15 @@ fromtext_soa(dns_rdataclass_t class, dns_rdatatype_t type,
if (result != DNS_R_SUCCESS)
return (result);
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region,
@ -60,12 +71,17 @@ fromtext_soa(dns_rdataclass_t class, dns_rdatatype_t type,
if (result != DNS_R_SUCCESS)
return (result);
options |= ISC_LEXOPT_NUMBER;
for (i = 0; i < 5; i++) {
if (isc_lex_gettoken(lexer, ISC_LEXOPT_NUMBER, &token)
!= ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_number)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_number) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
result = uint32_fromtext(token.value.as_ulong, target);
if (result != DNS_R_SUCCESS)
@ -84,7 +100,7 @@ totext_soa(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
isc_boolean_t sub;
int i;
INSIST(rdata->type == 6);
REQUIRE(rdata->type == 6);
dns_name_init(&mname, NULL);
dns_name_init(&rname, NULL);
@ -140,7 +156,7 @@ fromwire_soa(dns_rdataclass_t class, dns_rdatatype_t type,
isc_region_t sregion;
isc_region_t tregion;
INSIST(type == 6);
REQUIRE(type == 6);
class = class; /*unused*/
@ -158,8 +174,8 @@ fromwire_soa(dns_rdataclass_t class, dns_rdatatype_t type,
isc_buffer_active(source, &sregion);
isc_buffer_available(target, &tregion);
if (sregion.length != 20)
return (DNS_R_WIRE);
if (sregion.length < 20)
return (DNS_R_UNEXPECTEDEND);
if (tregion.length < 20)
return (DNS_R_NOSPACE);
@ -177,7 +193,7 @@ towire_soa(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
dns_name_t rname;
dns_result_t result;
INSIST(rdata->type == 6);
REQUIRE(rdata->type == 6);
dns_name_init(&mname, NULL);
dns_name_init(&rname, NULL);
@ -212,9 +228,9 @@ compare_soa(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
dns_name_t name2;
int result;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == 6);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == 6);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
@ -256,7 +272,7 @@ static dns_result_t
fromstruct_soa(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 6);
REQUIRE(type == 6);
class = class; /*unused*/
@ -269,7 +285,7 @@ fromstruct_soa(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_soa(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 6);
REQUIRE(rdata->type == 6);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: soa_6.h,v 1.5 1999/01/20 02:41:11 halley Exp $ */
/* $Id: soa_6.h,v 1.6 1999/01/20 05:20:23 marka Exp $ */
#ifndef RDATA_GENERIC_SOA_6_H
#define RDATA_GENERIC_SOA_6_H
@ -29,15 +29,21 @@ fromtext_soa(dns_rdataclass_t class, dns_rdatatype_t type,
isc_buffer_t buffer;
dns_result_t result;
int i;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 6);
REQUIRE(type == 6);
class = class; /*unused*/
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region,
@ -47,10 +53,15 @@ fromtext_soa(dns_rdataclass_t class, dns_rdatatype_t type,
if (result != DNS_R_SUCCESS)
return (result);
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region,
@ -60,12 +71,17 @@ fromtext_soa(dns_rdataclass_t class, dns_rdatatype_t type,
if (result != DNS_R_SUCCESS)
return (result);
options |= ISC_LEXOPT_NUMBER;
for (i = 0; i < 5; i++) {
if (isc_lex_gettoken(lexer, ISC_LEXOPT_NUMBER, &token)
!= ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_number)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_number) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
result = uint32_fromtext(token.value.as_ulong, target);
if (result != DNS_R_SUCCESS)
@ -84,7 +100,7 @@ totext_soa(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
isc_boolean_t sub;
int i;
INSIST(rdata->type == 6);
REQUIRE(rdata->type == 6);
dns_name_init(&mname, NULL);
dns_name_init(&rname, NULL);
@ -140,7 +156,7 @@ fromwire_soa(dns_rdataclass_t class, dns_rdatatype_t type,
isc_region_t sregion;
isc_region_t tregion;
INSIST(type == 6);
REQUIRE(type == 6);
class = class; /*unused*/
@ -158,8 +174,8 @@ fromwire_soa(dns_rdataclass_t class, dns_rdatatype_t type,
isc_buffer_active(source, &sregion);
isc_buffer_available(target, &tregion);
if (sregion.length != 20)
return (DNS_R_WIRE);
if (sregion.length < 20)
return (DNS_R_UNEXPECTEDEND);
if (tregion.length < 20)
return (DNS_R_NOSPACE);
@ -177,7 +193,7 @@ towire_soa(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
dns_name_t rname;
dns_result_t result;
INSIST(rdata->type == 6);
REQUIRE(rdata->type == 6);
dns_name_init(&mname, NULL);
dns_name_init(&rname, NULL);
@ -212,9 +228,9 @@ compare_soa(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
dns_name_t name2;
int result;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->type == 6);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->type == 6);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
@ -256,7 +272,7 @@ static dns_result_t
fromstruct_soa(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 6);
REQUIRE(type == 6);
class = class; /*unused*/
@ -269,7 +285,7 @@ fromstruct_soa(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_soa(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 6);
REQUIRE(rdata->type == 6);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: txt_16.c,v 1.4 1999/01/19 06:49:33 marka Exp $ */
/* $Id: txt_16.c,v 1.5 1999/01/20 05:20:24 marka Exp $ */
#ifndef RDATA_GENERIC_TXT_16_H
#define RDATA_GENERIC_TXT_16_H
@ -26,21 +26,21 @@ fromtext_txt(dns_rdataclass_t class, dns_rdatatype_t type,
isc_boolean_t downcase, isc_buffer_t *target) {
isc_token_t token;
dns_result_t result;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 16);
REQUIRE(type == 16);
class = class; /*unused*/
origin = origin; /*unused*/
downcase = downcase; /*unused*/
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
while (token.type == isc_tokentype_string) {
result = txt_fromtext(&token.value.as_textregion, target);
if (result != DNS_R_SUCCESS)
return (result);
if (isc_lex_gettoken(lexer, ISC_LEXOPT_EOL | ISC_LEXOPT_EOF,
&token) != ISC_R_SUCCESS)
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
}
/* Let upper layer handle eol/eof. */
@ -53,7 +53,7 @@ totext_txt(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
isc_region_t region;
dns_result_t result;
INSIST(rdata->type == 16);
REQUIRE(rdata->type == 16);
origin = origin; /*unused*/
@ -79,7 +79,7 @@ fromwire_txt(dns_rdataclass_t class, dns_rdatatype_t type,
isc_boolean_t downcase, isc_buffer_t *target) {
dns_result_t result;
INSIST(type == 16);
REQUIRE(type == 16);
dctx = dctx; /*unused*/
class = class; /*unused*/
@ -97,7 +97,7 @@ static dns_result_t
towire_txt(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
isc_region_t region;
INSIST(rdata->type == 16);
REQUIRE(rdata->type == 16);
cctx = cctx; /*unused*/
@ -115,9 +115,9 @@ compare_txt(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
int l;
int result;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->class == 16);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->class == 16);
l = (rdata1->length < rdata2->length) ? rdata1->length : rdata2->length;
result = memcmp(rdata1->data, rdata2->data, l);
@ -134,7 +134,7 @@ static dns_result_t
fromstruct_txt(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 16);
REQUIRE(type == 16);
class = class; /*unused*/
@ -147,7 +147,7 @@ fromstruct_txt(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_txt(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 16);
REQUIRE(rdata->type == 16);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: txt_16.h,v 1.4 1999/01/19 06:49:33 marka Exp $ */
/* $Id: txt_16.h,v 1.5 1999/01/20 05:20:24 marka Exp $ */
#ifndef RDATA_GENERIC_TXT_16_H
#define RDATA_GENERIC_TXT_16_H
@ -26,21 +26,21 @@ fromtext_txt(dns_rdataclass_t class, dns_rdatatype_t type,
isc_boolean_t downcase, isc_buffer_t *target) {
isc_token_t token;
dns_result_t result;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 16);
REQUIRE(type == 16);
class = class; /*unused*/
origin = origin; /*unused*/
downcase = downcase; /*unused*/
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
while (token.type == isc_tokentype_string) {
result = txt_fromtext(&token.value.as_textregion, target);
if (result != DNS_R_SUCCESS)
return (result);
if (isc_lex_gettoken(lexer, ISC_LEXOPT_EOL | ISC_LEXOPT_EOF,
&token) != ISC_R_SUCCESS)
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
}
/* Let upper layer handle eol/eof. */
@ -53,7 +53,7 @@ totext_txt(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
isc_region_t region;
dns_result_t result;
INSIST(rdata->type == 16);
REQUIRE(rdata->type == 16);
origin = origin; /*unused*/
@ -79,7 +79,7 @@ fromwire_txt(dns_rdataclass_t class, dns_rdatatype_t type,
isc_boolean_t downcase, isc_buffer_t *target) {
dns_result_t result;
INSIST(type == 16);
REQUIRE(type == 16);
dctx = dctx; /*unused*/
class = class; /*unused*/
@ -97,7 +97,7 @@ static dns_result_t
towire_txt(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
isc_region_t region;
INSIST(rdata->type == 16);
REQUIRE(rdata->type == 16);
cctx = cctx; /*unused*/
@ -115,9 +115,9 @@ compare_txt(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
int l;
int result;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->class);
INSIST(rdata1->class == 16);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->class);
REQUIRE(rdata1->class == 16);
l = (rdata1->length < rdata2->length) ? rdata1->length : rdata2->length;
result = memcmp(rdata1->data, rdata2->data, l);
@ -134,7 +134,7 @@ static dns_result_t
fromstruct_txt(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 16);
REQUIRE(type == 16);
class = class; /*unused*/
@ -147,7 +147,7 @@ fromstruct_txt(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_txt(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 16);
REQUIRE(rdata->type == 16);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: a_1.c,v 1.4 1999/01/20 02:41:11 halley Exp $ */
/* $Id: a_1.c,v 1.5 1999/01/20 05:20:24 marka Exp $ */
#ifndef RDATA_IN_1_A_1_H
#define RDATA_IN_1_A_1_H
@ -33,20 +33,26 @@ fromtext_in_a(dns_rdataclass_t class, dns_rdatatype_t type,
isc_token_t token;
struct in_addr addr;
isc_region_t region;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 1);
INSIST(class == 1);
REQUIRE(type == 1);
REQUIRE(class == 1);
origin = origin; /*unused*/
downcase = downcase; /*unused*/
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
if (inet_aton(token.value.as_pointer , &addr) != 1)
return (DNS_R_UNKNOWN);
return (DNS_R_UNEXPECTED);
isc_buffer_available(target, &region);
if (region.length < 4)
return (DNS_R_NOSPACE);
@ -59,9 +65,9 @@ static dns_result_t
totext_in_a(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
isc_region_t region;
INSIST(rdata->type == 1);
INSIST(rdata->class == 1);
INSIST(rdata->length == 4);
REQUIRE(rdata->type == 1);
REQUIRE(rdata->class == 1);
REQUIRE(rdata->length == 4);
origin = origin; /* unused */
@ -81,8 +87,8 @@ fromwire_in_a(dns_rdataclass_t class, dns_rdatatype_t type,
isc_region_t sregion;
isc_region_t tregion;
INSIST(type == 1);
INSIST(class == 1);
REQUIRE(type == 1);
REQUIRE(class == 1);
dctx = dctx; /* unused */
downcase = downcase; /* unused */
@ -90,8 +96,8 @@ fromwire_in_a(dns_rdataclass_t class, dns_rdatatype_t type,
isc_buffer_active(source, &sregion);
isc_buffer_available(target, &tregion);
if (sregion.length != 4)
return (DNS_R_WIRE);
if (sregion.length < 4)
return (DNS_R_UNEXPECTEDEND);
if (tregion.length < 4)
return (DNS_R_NOSPACE);
@ -105,8 +111,8 @@ static dns_result_t
towire_in_a(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
isc_region_t region;
INSIST(rdata->type == 1);
INSIST(rdata->class == 1);
REQUIRE(rdata->type == 1);
REQUIRE(rdata->class == 1);
cctx = cctx; /*unused*/
@ -122,10 +128,10 @@ static int
compare_in_a(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
int result;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->type);
INSIST(rdata1->type == 1);
INSIST(rdata1->class == 1);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->type);
REQUIRE(rdata1->type == 1);
REQUIRE(rdata1->class == 1);
result = memcmp(rdata1->data, rdata2->data, 4);
if (result != 0)
@ -138,8 +144,8 @@ static dns_result_t
fromstruct_in_a(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 1);
INSIST(class == 1);
REQUIRE(type == 1);
REQUIRE(class == 1);
source = source;
target = target;
@ -150,8 +156,8 @@ fromstruct_in_a(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_in_a(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 1);
INSIST(rdata->class == 1);
REQUIRE(rdata->type == 1);
REQUIRE(rdata->class == 1);
target = target;

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: a_1.h,v 1.4 1999/01/20 02:41:11 halley Exp $ */
/* $Id: a_1.h,v 1.5 1999/01/20 05:20:24 marka Exp $ */
#ifndef RDATA_IN_1_A_1_H
#define RDATA_IN_1_A_1_H
@ -33,20 +33,26 @@ fromtext_in_a(dns_rdataclass_t class, dns_rdatatype_t type,
isc_token_t token;
struct in_addr addr;
isc_region_t region;
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
INSIST(type == 1);
INSIST(class == 1);
REQUIRE(type == 1);
REQUIRE(class == 1);
origin = origin; /*unused*/
downcase = downcase; /*unused*/
if (isc_lex_gettoken(lexer, 0, &token) != ISC_R_SUCCESS)
return (DNS_R_UNKNOWN);
if (token.type != isc_tokentype_string)
return (DNS_R_UNKNOWN);
if (isc_lex_gettoken(lexer, options, &token) != ISC_R_SUCCESS)
return (DNS_R_UNEXPECTED);
if (token.type != isc_tokentype_string) {
isc_lex_ungettoken(lexer, &token);
if (token.type == isc_tokentype_eol ||
token.type == isc_tokentype_eof)
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
if (inet_aton(token.value.as_pointer , &addr) != 1)
return (DNS_R_UNKNOWN);
return (DNS_R_UNEXPECTED);
isc_buffer_available(target, &region);
if (region.length < 4)
return (DNS_R_NOSPACE);
@ -59,9 +65,9 @@ static dns_result_t
totext_in_a(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) {
isc_region_t region;
INSIST(rdata->type == 1);
INSIST(rdata->class == 1);
INSIST(rdata->length == 4);
REQUIRE(rdata->type == 1);
REQUIRE(rdata->class == 1);
REQUIRE(rdata->length == 4);
origin = origin; /* unused */
@ -81,8 +87,8 @@ fromwire_in_a(dns_rdataclass_t class, dns_rdatatype_t type,
isc_region_t sregion;
isc_region_t tregion;
INSIST(type == 1);
INSIST(class == 1);
REQUIRE(type == 1);
REQUIRE(class == 1);
dctx = dctx; /* unused */
downcase = downcase; /* unused */
@ -90,8 +96,8 @@ fromwire_in_a(dns_rdataclass_t class, dns_rdatatype_t type,
isc_buffer_active(source, &sregion);
isc_buffer_available(target, &tregion);
if (sregion.length != 4)
return (DNS_R_WIRE);
if (sregion.length < 4)
return (DNS_R_UNEXPECTEDEND);
if (tregion.length < 4)
return (DNS_R_NOSPACE);
@ -105,8 +111,8 @@ static dns_result_t
towire_in_a(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
isc_region_t region;
INSIST(rdata->type == 1);
INSIST(rdata->class == 1);
REQUIRE(rdata->type == 1);
REQUIRE(rdata->class == 1);
cctx = cctx; /*unused*/
@ -122,10 +128,10 @@ static int
compare_in_a(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
int result;
INSIST(rdata1->type == rdata2->type);
INSIST(rdata1->class == rdata2->type);
INSIST(rdata1->type == 1);
INSIST(rdata1->class == 1);
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->class == rdata2->type);
REQUIRE(rdata1->type == 1);
REQUIRE(rdata1->class == 1);
result = memcmp(rdata1->data, rdata2->data, 4);
if (result != 0)
@ -138,8 +144,8 @@ static dns_result_t
fromstruct_in_a(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
isc_buffer_t *target) {
INSIST(type == 1);
INSIST(class == 1);
REQUIRE(type == 1);
REQUIRE(class == 1);
source = source;
target = target;
@ -150,8 +156,8 @@ fromstruct_in_a(dns_rdataclass_t class, dns_rdatatype_t type, void *source,
static dns_result_t
tostruct_in_a(dns_rdata_t *rdata, void *target) {
INSIST(rdata->type == 1);
INSIST(rdata->class == 1);
REQUIRE(rdata->type == 1);
REQUIRE(rdata->class == 1);
target = target;

View file

@ -37,6 +37,9 @@ static char *text_table[DNS_R_LASTENTRY + 1] = {
"too many hops", /* 14 */
"disallowed (by application policy)", /* 15 */
"no more list elements", /* 16 */
"extra input text", /* 17 */
"extra input data", /* 18 */
"text too long", /* 19 */
};
char *