2666. [func] Added an 'options' argument to dns_name_fromstring()

			(API change from 9.7.0a2). [RT #20196]
parent 965b6e2a
2666. [func] Added an 'options' argument to dns_name_fromstring()
(API change from 9.7.0a2). [RT #20196]
2665. [func] Clarify syntax for managed-keys {} statement, add
ARM documentation about RFC 5011 support. [RT #19874]
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: server.c,v 1.544 2009/09/01 07:14:25 each Exp $ */
/* $Id: server.c,v 1.545 2009/09/01 17:36:51 jinmei Exp $ */
/*! \file */
......@@ -2901,7 +2901,7 @@ add_keydata_zone(dns_view_t *view, isc_mem_t *mctx) {
CHECK(dns_zone_create(&zone, mctx));
dns_name_init(&zname, NULL);
CHECK(dns_name_fromstring(&zname, KEYZONE, mctx));
CHECK(dns_name_fromstring(&zname, KEYZONE, 0, mctx));
CHECK(dns_zone_setorigin(zone, &zname));
dns_name_free(&zname, mctx);
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: name.h,v 1.131 2009/09/01 00:22:26 jinmei Exp $ */
/* $Id: name.h,v 1.132 2009/09/01 17:36:51 jinmei Exp $ */
#ifndef DNS_NAME_H
#define DNS_NAME_H 1
......@@ -1157,50 +1157,17 @@ dns_name_tostring(dns_name_t *source, char **target, isc_mem_t *mctx);
*/
isc_result_t
dns_name_fromstring(dns_name_t *target, const char *src, isc_mem_t *mctx);
dns_name_fromstring(dns_name_t *target, const char *src, unsigned int options,
isc_mem_t *mctx);
/*%<
* Convert a string to a name and place it in target, allocating memory
* as necessary.
*
* Returns:
*
*\li #ISC_R_SUCCESS
*
*\li Any error that dns_name_fromtext() can return.
*
*\li Any error that dns_name_dup() can return.
*/
isc_result_t
dns_name_tostring(dns_name_t *source, char **target, isc_mem_t *mctx);
/*%<
* Convert 'name' to string format, allocating sufficient memory to
* hold it (free with isc_mem_free()).
*
* Differs from dns_name_format in that it allocates its own memory.
*
* Requires:
*
*\li 'name' is a valid name.
*\li 'target' is not NULL.
*\li '*target' is NULL.
*
* Returns:
*
*\li ISC_R_SUCCESS
*
*\li Any error that dns_name_totext() can return.
*/
isc_result_t
dns_name_fromstring(dns_name_t *target, const char *src, isc_mem_t *mctx);
/*%<
* Convert a string to a name and place it in target, allocating memory
* as necessary.
* as necessary. 'options' has the same semantics as that of
* dns_name_fromtext().
*
* Requires:
*
* \li 'target' is a valid name that is not read-only.
* \li 'src' is not NULL.
*
* Returns:
*
......@@ -1300,13 +1267,6 @@ dns_name_destroy(void);
* non-NULL argument prior to calling dns_name_destroy();
*/
isc_result_t
dns_name_fromstr(dns_name_t *name, const char *source, const char *origin,
unsigned int options, isc_buffer_t *target);
/*%<
* TBD
*/
ISC_LANG_ENDDECLS
/*
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: name.c,v 1.168 2009/09/01 00:22:26 jinmei Exp $ */
/* $Id: name.c,v 1.169 2009/09/01 17:36:51 jinmei Exp $ */
/*! \file */
......@@ -1019,32 +1019,6 @@ dns_name_toregion(dns_name_t *name, isc_region_t *r) {
DNS_NAME_TOREGION(name, r);
}
isc_result_t
dns_name_fromstr(dns_name_t *name, const char *source, const char *origin,
unsigned int options, isc_buffer_t *target)
{
dns_name_t *o;
dns_fixedname_t fixed;
isc_buffer_t b;
isc_result_t result;
REQUIRE(source != NULL);
if (origin != NULL) {
isc_buffer_init(&b, origin, strlen(origin));
isc_buffer_add(&b, strlen(origin));
dns_fixedname_init(&fixed);
o = dns_fixedname_name(&fixed);
result = dns_name_fromtext(o, &b, dns_rootname, options, NULL);
if (result != ISC_R_SUCCESS)
return(result);
} else
o = dns_rootname;
isc_buffer_init(&b, source, strlen(source));
isc_buffer_add(&b, strlen(source));
return (dns_name_fromtext(name, &b, o, options, target));
}
isc_result_t
dns_name_fromtext(dns_name_t *name, isc_buffer_t *source,
dns_name_t *origin, unsigned int options,
......@@ -2399,18 +2373,22 @@ dns_name_tostring(dns_name_t *name, char **target, isc_mem_t *mctx) {
* allocating memory as needed
*/
isc_result_t
dns_name_fromstring(dns_name_t *target, const char *src, isc_mem_t *mctx) {
dns_name_fromstring(dns_name_t *target, const char *src, unsigned int options,
isc_mem_t *mctx)
{
isc_result_t result;
isc_buffer_t buf;
dns_fixedname_t fn;
dns_name_t *name;
REQUIRE(src != NULL);
isc_buffer_init(&buf, src, strlen(src));
isc_buffer_add(&buf, strlen(src));
dns_fixedname_init(&fn);
name = dns_fixedname_name(&fn);
result = dns_name_fromtext(name, &buf, dns_rootname, 0, NULL);
result = dns_name_fromtext(name, &buf, dns_rootname, options, NULL);
if (result != ISC_R_SUCCESS)
return (result);
......
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