⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 name.h

📁 package of develop dns
💻 H
📖 第 1 页 / 共 3 页
字号:
 *   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_tdns_name_tofilenametext(dns_name_t *name, isc_boolean_t omit_final_dot,			isc_buffer_t *target);/* * Convert 'name' into an alternate text format appropriate for filenames, * storing the result in 'target'.  The name data is downcased, guaranteeing * that the filename does not depend on the case of the converted name. * * Notes: *	If 'omit_final_dot' is true, then the final '.' in absolute *	names other than the root name will be omitted. * *	The name is not NUL terminated. * * Requires: * *	'name' is a valid absolute name * *	'target' is a valid buffer. * * Ensures: * *	If the result is success: * *		The used space in target is updated. * * Returns: *	ISC_R_SUCCESS *	ISC_R_NOSPACE */isc_result_tdns_name_downcase(dns_name_t *source, dns_name_t *name,		  isc_buffer_t *target);/* * Downcase 'source'. * * Requires: * *	'source' and 'name' are valid names. * *	If source == name, then * *		'source' must not be read-only * *	Otherwise, * *		'target' is a valid buffer or 'target' is NULL and *		'name' has a dedicated buffer. * * Returns: *	ISC_R_SUCCESS *	ISC_R_NOSPACE * * Note: if source == name, then the result will always be ISC_R_SUCCESS. */isc_result_tdns_name_concatenate(dns_name_t *prefix, dns_name_t *suffix,		     dns_name_t *name, isc_buffer_t *target);/* *	Concatenate 'prefix' and 'suffix'. * * Requires: * *	'prefix' is a valid name or NULL. * *	'suffix' is a valid name or NULL. * *	'name' is a valid name or NULL. * *	'target' is a valid buffer or 'target' is NULL and 'name' has *	a dedicated buffer. * *	If 'prefix' is absolute, 'suffix' must be NULL or the empty name. * * Ensures: * *	On success, *	 	If 'target' is not NULL and 'name' is not NULL, then 'name' *		is attached to it. * *		The used space in target is updated. * * Returns: *	ISC_R_SUCCESS *	ISC_R_NOSPACE *	DNS_R_NAMETOOLONG */voiddns_name_split(dns_name_t *name, unsigned int suffixlabels,	       dns_name_t *prefix, dns_name_t *suffix);/* * * Split 'name' into two pieces on a label boundary. * * Notes: *      'name' is split such that 'suffix' holds the most significant *      'suffixlabels' labels.  All other labels are stored in 'prefix'.  * *	Copying name data is avoided as much as possible, so 'prefix' *	and 'suffix' will end up pointing at the data for 'name'. * *	It is legitimate to pass a 'prefix' or 'suffix' that has *	its name data stored someplace other than the dedicated buffer. *	This is useful to avoid name copying in the calling function. * *	It is also legitimate to pass a 'prefix' or 'suffix' that is *	the same dns_name_t as 'name'. * * Requires: *	'name' is a valid name. * * 	'suffixlabels' cannot exceed the number of labels in 'name'. * *	'prefix' is a valid name or NULL, and cannot be read-only. * *	'suffix' is a valid name or NULL, and cannot be read-only. * *	If non-NULL, 'prefix' and 'suffix' must have dedicated buffers. * *	'prefix' and 'suffix' cannot point to the same buffer. * * Ensures: * *	On success: *		If 'prefix' is not NULL it will contain the least significant *		labels. * *		If 'suffix' is not NULL it will contain the most significant *		labels.  dns_name_countlabels(suffix) will be equal to *		suffixlabels. * *	On failure: *		Either 'prefix' or 'suffix' is invalidated (depending *		on which one the problem was encountered with). * * Returns: *	ISC_R_SUCCESS	No worries.  (This function should always success). */isc_result_tdns_name_dup(dns_name_t *source, isc_mem_t *mctx, dns_name_t *target);/* * Make 'target' a dynamically allocated copy of 'source'. * * Requires: * *	'source' is a valid non-empty name. * *	'target' is a valid name that is not read-only. * *	'mctx' is a valid memory context. */isc_result_tdns_name_dupwithoffsets(dns_name_t *source, isc_mem_t *mctx,			dns_name_t *target);/* * Make 'target' a read-only dynamically allocated copy of 'source'. * 'target' will also have a dynamically allocated offsets table. * * Requires: * *	'source' is a valid non-empty name. * *	'target' is a valid name that is not read-only. * *	'target' has no offsets table. * *	'mctx' is a valid memory context. */voiddns_name_free(dns_name_t *name, isc_mem_t *mctx);/* * Free 'name'. * * Requires: * *	'name' is a valid name created previously in 'mctx' by dns_name_dup(). * *	'mctx' is a valid memory context. * * Ensures: * *	All dynamic resources used by 'name' are freed and the name is *	invalidated. */isc_result_tdns_name_digest(dns_name_t *name, dns_digestfunc_t digest, void *arg);/* * Send 'name' in DNSSEC canonical form to 'digest'. * * Requires: * *	'name' is a valid name. * *	'digest' is a valid dns_digestfunc_t. * * Ensures: * *	If successful, the DNSSEC canonical form of 'name' will have been *	sent to 'digest'. * *	If digest() returns something other than ISC_R_SUCCESS, that result *	will be returned as the result of dns_name_digest(). * * Returns: * *	ISC_R_SUCCESS * *	Many other results are possible if not successful. * */isc_boolean_tdns_name_dynamic(dns_name_t *name);/* * Returns whether there is dynamic memory associated with this name. * * Requires: * *	'name' is a valid name. * * Returns: * *	'ISC_TRUE' if the name is dynamic othewise 'ISC_FALSE'. */isc_result_tdns_name_print(dns_name_t *name, FILE *stream);/* * Print 'name' on 'stream'. * * Requires: * *	'name' is a valid name. * *	'stream' is a valid stream. * * Returns: * *	ISC_R_SUCCESS * *	Any error that dns_name_totext() can return. */voiddns_name_format(dns_name_t *name, char *cp, unsigned int size);/* * Format 'name' as text appropriate for use in log messages. * * Store the formatted name at 'cp', writing no more than * 'size' bytes.  The resulting string is guaranteed to be * null terminated. * * The formatted name will have a terminating dot only if it is * the root. * * This function cannot fail, instead any errors are indicated * in the returned text. * * Requires: * *	'name' is a valid name. * *	'cp' points a valid character array of size 'size'. * *	'size' > 0. * */#define DNS_NAME_FORMATSIZE (DNS_NAME_MAXTEXT + 1)/* * Suggested size of buffer passed to dns_name_format(). * Includes space for the terminating NULL. */isc_result_tdns_name_copy(dns_name_t *source, dns_name_t *dest, isc_buffer_t *target);/* * Makes 'dest' refer to a copy of the name in 'source'.  The data are * either copied to 'target' or the dedicated buffer in 'dest'. * * Requires: * 	'source' is a valid name. * * 	'dest' is an initialized name with a dedicated buffer. * * 	'target' is NULL or an initialized buffer. * * 	Either dest has a dedicated buffer or target != NULL. * * Ensures: * *	On success, the used space in target is updated. * * Returns: *	ISC_R_SUCCESS *	ISC_R_NOSPACE */isc_boolean_tdns_name_ishostname(const dns_name_t *name, isc_boolean_t wildcard);/* * Return if 'name' is a valid hostname.  RFC 952 / RFC 1123. * If 'wildcard' is ISC_TRUE then allow the first label of name to * be a wildcard. * The root is also accepted. * * Requires: *	'name' to be valid. */ isc_boolean_tdns_name_ismailbox(const dns_name_t *name);/* * Return if 'name' is a valid mailbox.  RFC 821. * * Requires: *	'name' to be valid. */ISC_LANG_ENDDECLS/*** *** High Peformance Macros ***//* * WARNING:  Use of these macros by applications may require recompilation *           of the application in some situations where calling the function *           would not. * * WARNING:  No assertion checking is done for these macros. */#define DNS_NAME_INIT(n, o) \do { \	(n)->magic = DNS_NAME_MAGIC; \	(n)->ndata = NULL; \	(n)->length = 0; \	(n)->labels = 0; \	(n)->attributes = 0; \	(n)->offsets = (o); \	(n)->buffer = NULL; \	ISC_LINK_INIT((n), link); \	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)#define DNS_NAME_ISABSOLUTE(n) \	(((n)->attributes & DNS_NAMEATTR_ABSOLUTE) != 0 ? ISC_TRUE : ISC_FALSE)#define DNS_NAME_COUNTLABELS(n) \	((n)->labels)#define DNS_NAME_TOREGION(n, r) \do { \	(r)->base = (n)->ndata; \	(r)->length = (n)->length; \} while (0)#define DNS_NAME_SPLIT(n, l, p, s) \do { \	dns_name_t *_n = (n); \	dns_name_t *_p = (p); \	dns_name_t *_s = (s); \	unsigned int _l = (l); \	if (_p != NULL) \		dns_name_getlabelsequence(_n, 0, _n->labels - _l, _p); \	if (_s != NULL) \		dns_name_getlabelsequence(_n, _n->labels - _l, _l, _s); \} while (0)#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_setbuffer(n, b)	DNS_NAME_SETBUFFER(n, b)#define dns_name_countlabels(n)		DNS_NAME_COUNTLABELS(n)#define dns_name_isabsolute(n)		DNS_NAME_ISABSOLUTE(n)#define dns_name_toregion(n, r)		DNS_NAME_TOREGION(n, r)#define dns_name_split(n, l, p, s)	DNS_NAME_SPLIT(n, l, p, s)#endif /* DNS_NAME_USEINLINE */#endif /* DNS_NAME_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -