Commit da527e4f authored by David Lawrence's avatar David Lawrence
Browse files

332. [func] New function dns_name_reset().

parent 8cd54a74
332. [func] New function dns_name_reset().
331. [bug] Only log "recursion denied" if RD is set. (RT #178)
330. [func] New function isc_log_wouldlog().
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: name.h,v 1.74 2000/07/13 18:10:16 bwelling Exp $ */
/* $Id: name.h,v 1.75 2000/07/14 19:12:51 tale Exp $ */
#ifndef DNS_NAME_H
#define DNS_NAME_H 1
......@@ -236,6 +236,32 @@ dns_name_init(dns_name_t *name, unsigned char *offsets);
* Ensures:
* 'name' is a valid name.
* dns_name_countlabels(name) == 0
* dns_name_isabsolute(name) == ISC_FALSE
*/
void
dns_name_reset(dns_name_t *name);
/*
* Reinitialize 'name'.
*
* Notes:
* This function distinguishes itself from dns_name_init() in two
* key ways:
*
* + If any buffer is associated with 'name' (via dns_name_setbuffer()
* or by being part of a dns_fixedname_t) the link to the buffer
* is retained but the buffer itself is cleared.
*
* + Of the attributes associated with 'name', all are retained except
* DNS_NAMEATTR_ABSOLUTE.
*
* Requires:
* 'name' is a valid name.
*
* Ensures:
* 'name' is a valid name.
* dns_name_countlabels(name) == 0
* dns_name_isabsolute(name) == ISC_FALSE
*/
void
......@@ -1182,6 +1208,7 @@ ISC_LANG_ENDDECLS
#ifdef DNS_NAME_USEINLINE
#define dns_name_init(n, o) DNS_NAME_INIT(n, o)
#define dns_name_reset(n) DNS_NAME_RESET(n)
#define dns_name_countlabels(n) DNS_NAME_COUNTLABELS(n)
#define dns_name_isabsolute(n) DNS_NAME_ISABSOLUTE(n)
......@@ -1198,6 +1225,16 @@ do { \
ISC_LIST_INIT((n)->list); \
} while (0)
#define DNS_NAME_RESET(n) \
do { \
(n)->ndata = NULL; \
(n)->length = 0; \
(n)->labels = 0; \
(n)->attributes &= ~DNS_NAMEATTR_ABSOLUTE; \
if ((n)->buffer != NULL) \
isc_buffer_clear((n)->buffer); \
} while (0)
#define DNS_NAME_SETBUFFER(n, b) \
(n)->buffer = (b)
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: name.c,v 1.94 2000/07/13 18:10:18 bwelling Exp $ */
/* $Id: name.c,v 1.95 2000/07/14 19:12:53 tale Exp $ */
#include <config.h>
......@@ -320,6 +320,16 @@ dns_name_init(dns_name_t *name, unsigned char *offsets) {
ISC_LIST_INIT(name->list);
}
void
dns_name_reset(dns_name_t *name) {
REQUIRE(VALID_NAME(name));
REQUIRE(BINDABLE(name));
MAKE_EMPTY(name);
if (name->buffer != NULL)
isc_buffer_clear(name->buffer);
}
void
dns_name_invalidate(dns_name_t *name) {
/*
......@@ -2476,7 +2486,7 @@ dns_name_concatenate(dns_name_t *prefix, dns_name_t *suffix, dns_name_t *name,
REQUIRE(BINDABLE(name));
/*
* IMPORTANT NOTE
* XXX IMPORTANT NOTE
*
* If the most-signficant label in prefix is a bitstring,
* and the least-signficant label in suffix is a bitstring,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment