2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

added DNS_NAME_MAXTEXT and DNS_NAME_FORMATSIZE

This commit is contained in:
Andreas Gustafsson
2000-08-08 23:20:14 +00:00
parent f4bc158a46
commit 4a2af70858

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: name.h,v 1.79 2000/08/08 23:18:12 gson Exp $ */
/* $Id: name.h,v 1.80 2000/08/08 23:20:14 gson Exp $ */
#ifndef DNS_NAME_H
#define DNS_NAME_H 1
@@ -893,6 +893,29 @@ dns_name_totext(dns_name_t *name, isc_boolean_t omit_final_dot,
* ISC_R_NOSPACE
*/
#define DNS_NAME_MAXTEXT 1023
/*
* The maximum length of the text representation of a domain
* name as generated by dns_name_totext(). This does not
* include space for a terminating NULL.
*
* This definition is conservative - the actual maximum
* is 1004, derived as follows:
*
* A backslash-decimal escaped character takes 4 bytes.
* A wire-encoded name can be up to 255 bytes and each
* label is one length byte + at most 63 bytes of data.
* Maximizing the label lengths gives us a name of
* three 63-octet labels, one 61-octet label, and the
* root label:
*
* 1 + 63 + 1 + 63 + 1 + 63 + 1 + 61 + 1 = 255
*
* When printed, this is (3 * 63 + 61) * 4
* bytes for the escaped label data + 4 bytes for the
* dot terminating each label = 1004 bytes total.
*/
isc_result_t
dns_name_downcase(dns_name_t *source, dns_name_t *name,
isc_buffer_t *target);
@@ -1185,6 +1208,12 @@ dns_name_format(dns_name_t *name, char *cp, unsigned int size);
*
*/
#define DNS_NAME_FORMATSIZE (DNS_NAME_MAXTEXT + 1)
/*
* Suggested size of buffer passed to dns_name_format().
* Includes space for the terminating NULL.
*/
ISC_LANG_ENDDECLS
/***