+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]
* 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 */
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);
* 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
*/
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:
*
* 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
/*
* 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 */
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,
* 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);