/src/bind9/lib/dns/include/dns/name.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (C) Internet Systems Consortium, Inc. ("ISC") |
3 | | * |
4 | | * SPDX-License-Identifier: MPL-2.0 |
5 | | * |
6 | | * This Source Code Form is subject to the terms of the Mozilla Public |
7 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
8 | | * file, you can obtain one at https://mozilla.org/MPL/2.0/. |
9 | | * |
10 | | * See the COPYRIGHT file distributed with this work for additional |
11 | | * information regarding copyright ownership. |
12 | | */ |
13 | | |
14 | | #pragma once |
15 | | |
16 | | /***** |
17 | | ***** Module Info |
18 | | *****/ |
19 | | |
20 | | /*! \file dns/name.h |
21 | | * \brief |
22 | | * Provides facilities for manipulating DNS names and labels, including |
23 | | * conversions to and from wire format and text format. |
24 | | * |
25 | | * Given the large number of names possible in a nameserver, and because |
26 | | * names occur in rdata, it was important to come up with a very efficient |
27 | | * way of storing name data, but at the same time allow names to be |
28 | | * manipulated. The decision was to store names in uncompressed wire format, |
29 | | * and not to make them fully abstracted objects; i.e. certain parts of the |
30 | | * server know names are stored that way. This saves a lot of memory, and |
31 | | * makes adding names to messages easy. Having much of the server know |
32 | | * the representation would be perilous, and we certainly don't want each |
33 | | * user of names to be manipulating such a low-level structure. This is |
34 | | * where the Names and Labels module comes in. The module allows name |
35 | | * handles to be created and attached to uncompressed wire format |
36 | | * regions. All name operations and conversions are done through these |
37 | | * handles. |
38 | | * |
39 | | * MP: |
40 | | *\li Clients of this module must impose any required synchronization. |
41 | | * |
42 | | * Reliability: |
43 | | *\li This module deals with low-level byte streams. Errors in any of |
44 | | * the functions are likely to crash the server or corrupt memory. |
45 | | * |
46 | | * Resources: |
47 | | *\li None. |
48 | | * |
49 | | * Security: |
50 | | * |
51 | | *\li *** WARNING *** |
52 | | * |
53 | | *\li dns_name_fromwire() deals with raw network data. An error in |
54 | | * this routine could result in the failure or hijacking of the server. |
55 | | * |
56 | | * Standards: |
57 | | *\li RFC1035 |
58 | | *\li Draft EDNS0 (0) |
59 | | * |
60 | | */ |
61 | | |
62 | | /*** |
63 | | *** Imports |
64 | | ***/ |
65 | | |
66 | | #include <inttypes.h> |
67 | | #include <stdbool.h> |
68 | | #include <stdio.h> |
69 | | |
70 | | #include <isc/attributes.h> |
71 | | #include <isc/buffer.h> |
72 | | #include <isc/hashmap.h> |
73 | | #include <isc/magic.h> |
74 | | #include <isc/region.h> /* Required for storage size of dns_label_t. */ |
75 | | |
76 | | #include <dns/types.h> |
77 | | |
78 | | /***** |
79 | | ***** Names |
80 | | ***** |
81 | | ***** A 'name' is a handle to a binary region. It contains a sequence of one |
82 | | ***** or more DNS wire format labels. |
83 | | ***** Note that all names are not required to end with the root label, |
84 | | ***** as they are in the actual DNS wire protocol. |
85 | | *****/ |
86 | | |
87 | | /*** |
88 | | *** Types |
89 | | ***/ |
90 | | |
91 | | /*% |
92 | | * Clients are strongly discouraged from using this type directly, with |
93 | | * the exception of the 'link' and 'list' fields which may be used directly |
94 | | * for whatever purpose the client desires. |
95 | | */ |
96 | | struct dns_name { |
97 | | unsigned int magic; |
98 | | uint8_t length; |
99 | | struct dns_name_attrs { |
100 | | bool absolute : 1; /*%< Used by name.c */ |
101 | | bool readonly : 1; /*%< Used by name.c */ |
102 | | bool dynamic : 1; /*%< Used by name.c */ |
103 | | bool nocompress : 1; /*%< Used by name.c */ |
104 | | bool cache : 1; /*%< Used by resolver. */ |
105 | | bool answer : 1; /*%< Used by resolver. */ |
106 | | bool ncache : 1; /*%< Used by resolver. */ |
107 | | bool chaining : 1; /*%< Used by resolver. */ |
108 | | bool chase : 1; /*%< Used by resolver. */ |
109 | | bool wildcard : 1; /*%< Used by server. */ |
110 | | bool prerequisite : 1; /*%< Used by client. */ |
111 | | bool update : 1; /*%< Used by client. */ |
112 | | bool hasupdaterec : 1; /*%< Used by client. */ |
113 | | } attributes; |
114 | | unsigned char *ndata; |
115 | | isc_buffer_t *buffer; |
116 | | ISC_LINK(dns_name_t) link; |
117 | | ISC_LIST(dns_rdataset_t) list; |
118 | | isc_hashmap_t *hashmap; |
119 | | }; |
120 | | |
121 | 150M | #define DNS_NAME_MAGIC ISC_MAGIC('D', 'N', 'S', 'n') |
122 | 0 | #define DNS_NAME_VALID(n) ISC_MAGIC_VALID(n, DNS_NAME_MAGIC) |
123 | | |
124 | | /*% |
125 | | * A name is "bindable" if it can be set to point to a new value, i.e. |
126 | | * name->ndata and name->length may be changed. |
127 | | */ |
128 | | #define DNS_NAME_BINDABLE(name) \ |
129 | 8 | (!name->attributes.readonly && !name->attributes.dynamic) |
130 | | |
131 | | /* |
132 | | * Various flags. |
133 | | */ |
134 | 20.2M | #define DNS_NAME_DOWNCASE 0x0001 |
135 | 8.73M | #define DNS_NAME_CHECKNAMES 0x0002 /*%< Used by rdata. */ |
136 | 0 | #define DNS_NAME_CHECKNAMESFAIL 0x0004 /*%< Used by rdata. */ |
137 | 274k | #define DNS_NAME_CHECKREVERSE 0x0008 /*%< Used by rdata. */ |
138 | 4.26k | #define DNS_NAME_CHECKMX 0x0010 /*%< Used by rdata. */ |
139 | 0 | #define DNS_NAME_CHECKMXFAIL 0x0020 /*%< Used by rdata. */ |
140 | | |
141 | | extern const dns_name_t *dns_rootname; |
142 | | extern const dns_name_t *dns_wildcardname; |
143 | | extern const dns_name_t *dns_ip6arpa; |
144 | | extern const dns_name_t *dns_ip6int; |
145 | | extern const dns_name_t *dns_inaddrarpa; |
146 | | |
147 | | /*%< |
148 | | * DNS_NAME_INITNONABSOLUTE and DNS_NAME_INITABSOLUTE are macros for |
149 | | * initializing dns_name_t structures. |
150 | | * |
151 | | * Note[1]: 'length' is set to (sizeof(A) - 1) in DNS_NAME_INITNONABSOLUTE |
152 | | * and sizeof(A) in DNS_NAME_INITABSOLUTE to allow C strings to be used |
153 | | * to initialize 'ndata'. |
154 | | * |
155 | | * Typical usage: |
156 | | * unsigned char data[] = "\005value"; |
157 | | * dns_name_t value = DNS_NAME_INITNONABSOLUTE(data); |
158 | | * |
159 | | * unsigned char data[] = "\005value"; |
160 | | * dns_name_t value = DNS_NAME_INITABSOLUTE(data); |
161 | | */ |
162 | | #define DNS_NAME_INITNONABSOLUTE(__ndata) \ |
163 | | { \ |
164 | | .magic = DNS_NAME_MAGIC, \ |
165 | | .ndata = (__ndata), \ |
166 | | .length = (sizeof(__ndata) - 1), \ |
167 | | .attributes = { .readonly = true }, \ |
168 | | .link = ISC_LINK_INITIALIZER, \ |
169 | | .list = ISC_LIST_INITIALIZER, \ |
170 | | } |
171 | | |
172 | | #define DNS_NAME_INITABSOLUTE(__ndata) \ |
173 | | { \ |
174 | | .magic = DNS_NAME_MAGIC, \ |
175 | | .ndata = (__ndata), \ |
176 | | .length = sizeof(__ndata), \ |
177 | | .attributes = { .readonly = true, .absolute = true }, \ |
178 | | .link = ISC_LINK_INITIALIZER, \ |
179 | | .list = ISC_LIST_INITIALIZER, \ |
180 | | } |
181 | | |
182 | | #define DNS_NAME_INITEMPTY \ |
183 | 10.7M | { .magic = DNS_NAME_MAGIC, \ |
184 | 10.7M | .link = ISC_LINK_INITIALIZER, \ |
185 | 10.7M | .list = ISC_LIST_INITIALIZER } |
186 | | |
187 | | /*% |
188 | | * Standard sizes of a wire format name |
189 | | */ |
190 | 260M | #define DNS_NAME_MAXWIRE 255 |
191 | 0 | #define DNS_NAME_MAXLABELS 128 |
192 | 120M | #define DNS_NAME_LABELLEN 63 |
193 | | |
194 | | typedef uint8_t dns_offsets_t[DNS_NAME_MAXLABELS]; |
195 | | |
196 | | /* |
197 | | * Text output filter procedure. |
198 | | * 'target' is the buffer to be converted. The region to be converted |
199 | | * is from 'buffer'->base + 'used_org' to the end of the used region. |
200 | | */ |
201 | | typedef isc_result_t(dns_name_totextfilter_t)(isc_buffer_t *target, |
202 | | unsigned int used_org); |
203 | | |
204 | | /*** |
205 | | *** Initialization |
206 | | ***/ |
207 | | |
208 | | static inline void |
209 | 139M | dns_name_init(dns_name_t *name) { |
210 | 139M | *name = (dns_name_t){ |
211 | 139M | .magic = DNS_NAME_MAGIC, |
212 | 139M | .link = ISC_LINK_INITIALIZER, |
213 | 139M | .list = ISC_LIST_INITIALIZER, |
214 | 139M | }; |
215 | 139M | } Unexecuted instantiation: dns_qp.c:dns_name_init Unexecuted instantiation: main.c:dns_name_init Unexecuted instantiation: qp.c:dns_name_init fixedname.c:dns_name_init Line | Count | Source | 209 | 9.95M | dns_name_init(dns_name_t *name) { | 210 | 9.95M | *name = (dns_name_t){ | 211 | 9.95M | .magic = DNS_NAME_MAGIC, | 212 | 9.95M | .link = ISC_LINK_INITIALIZER, | 213 | | .list = ISC_LIST_INITIALIZER, | 214 | 9.95M | }; | 215 | 9.95M | } |
Unexecuted instantiation: lib.c:dns_name_init Line | Count | Source | 209 | 939k | dns_name_init(dns_name_t *name) { | 210 | 939k | *name = (dns_name_t){ | 211 | 939k | .magic = DNS_NAME_MAGIC, | 212 | 939k | .link = ISC_LINK_INITIALIZER, | 213 | | .list = ISC_LIST_INITIALIZER, | 214 | 939k | }; | 215 | 939k | } |
Line | Count | Source | 209 | 13.6M | dns_name_init(dns_name_t *name) { | 210 | 13.6M | *name = (dns_name_t){ | 211 | 13.6M | .magic = DNS_NAME_MAGIC, | 212 | 13.6M | .link = ISC_LINK_INITIALIZER, | 213 | | .list = ISC_LIST_INITIALIZER, | 214 | 13.6M | }; | 215 | 13.6M | } |
Line | Count | Source | 209 | 115M | dns_name_init(dns_name_t *name) { | 210 | 115M | *name = (dns_name_t){ | 211 | 115M | .magic = DNS_NAME_MAGIC, | 212 | 115M | .link = ISC_LINK_INITIALIZER, | 213 | | .list = ISC_LIST_INITIALIZER, | 214 | 115M | }; | 215 | 115M | } |
Unexecuted instantiation: rdataset.c:dns_name_init Unexecuted instantiation: rdatavec.c:dns_name_init Line | Count | Source | 209 | 2 | dns_name_init(dns_name_t *name) { | 210 | 2 | *name = (dns_name_t){ | 211 | 2 | .magic = DNS_NAME_MAGIC, | 212 | 2 | .link = ISC_LINK_INITIALIZER, | 213 | | .list = ISC_LIST_INITIALIZER, | 214 | 2 | }; | 215 | 2 | } |
Unexecuted instantiation: zonefetch.c:dns_name_init Unexecuted instantiation: zonemgr.c:dns_name_init Unexecuted instantiation: zoneproperties.c:dns_name_init Unexecuted instantiation: zoneverify.c:dns_name_init Unexecuted instantiation: resolver.c:dns_name_init Unexecuted instantiation: xfrin.c:dns_name_init Unexecuted instantiation: acl.c:dns_name_init Unexecuted instantiation: adb.c:dns_name_init Unexecuted instantiation: catz.c:dns_name_init Unexecuted instantiation: compress.c:dns_name_init Unexecuted instantiation: db.c:dns_name_init Unexecuted instantiation: dbiterator.c:dns_name_init Unexecuted instantiation: diff.c:dns_name_init Unexecuted instantiation: dispatch.c:dns_name_init Unexecuted instantiation: dlz.c:dns_name_init Unexecuted instantiation: dns64.c:dns_name_init Unexecuted instantiation: dnssec.c:dns_name_init Unexecuted instantiation: ds.c:dns_name_init Line | Count | Source | 209 | 98 | dns_name_init(dns_name_t *name) { | 210 | 98 | *name = (dns_name_t){ | 211 | 98 | .magic = DNS_NAME_MAGIC, | 212 | 98 | .link = ISC_LINK_INITIALIZER, | 213 | | .list = ISC_LIST_INITIALIZER, | 214 | 98 | }; | 215 | 98 | } |
Unexecuted instantiation: dyndb.c:dns_name_init Unexecuted instantiation: ede.c:dns_name_init Unexecuted instantiation: forward.c:dns_name_init Unexecuted instantiation: hmac_link.c:dns_name_init Unexecuted instantiation: ipkeylist.c:dns_name_init Unexecuted instantiation: iptable.c:dns_name_init Unexecuted instantiation: journal.c:dns_name_init Unexecuted instantiation: kasp.c:dns_name_init Unexecuted instantiation: key.c:dns_name_init Unexecuted instantiation: keydata.c:dns_name_init Unexecuted instantiation: keymgr.c:dns_name_init Unexecuted instantiation: keystore.c:dns_name_init Unexecuted instantiation: keytable.c:dns_name_init Line | Count | Source | 209 | 14.3k | dns_name_init(dns_name_t *name) { | 210 | 14.3k | *name = (dns_name_t){ | 211 | 14.3k | .magic = DNS_NAME_MAGIC, | 212 | 14.3k | .link = ISC_LINK_INITIALIZER, | 213 | | .list = ISC_LIST_INITIALIZER, | 214 | 14.3k | }; | 215 | 14.3k | } |
Unexecuted instantiation: masterdump.c:dns_name_init Line | Count | Source | 209 | 21.4k | dns_name_init(dns_name_t *name) { | 210 | 21.4k | *name = (dns_name_t){ | 211 | 21.4k | .magic = DNS_NAME_MAGIC, | 212 | 21.4k | .link = ISC_LINK_INITIALIZER, | 213 | | .list = ISC_LIST_INITIALIZER, | 214 | 21.4k | }; | 215 | 21.4k | } |
Unexecuted instantiation: nametree.c:dns_name_init Unexecuted instantiation: ncache.c:dns_name_init Unexecuted instantiation: notify.c:dns_name_init Unexecuted instantiation: nsec.c:dns_name_init Unexecuted instantiation: nsec3.c:dns_name_init Unexecuted instantiation: opensslecdsa_link.c:dns_name_init Unexecuted instantiation: openssleddsa_link.c:dns_name_init Unexecuted instantiation: opensslrsa_link.c:dns_name_init Unexecuted instantiation: peer.c:dns_name_init Unexecuted instantiation: private.c:dns_name_init Unexecuted instantiation: qpcache.c:dns_name_init Unexecuted instantiation: rcode.c:dns_name_init Unexecuted instantiation: rdatalist.c:dns_name_init Unexecuted instantiation: rdatasetiter.c:dns_name_init Unexecuted instantiation: rdataslab.c:dns_name_init Unexecuted instantiation: remote.c:dns_name_init Unexecuted instantiation: request.c:dns_name_init Unexecuted instantiation: rpz.c:dns_name_init Unexecuted instantiation: rriterator.c:dns_name_init Unexecuted instantiation: skr.c:dns_name_init Unexecuted instantiation: soa.c:dns_name_init Unexecuted instantiation: ssu.c:dns_name_init Unexecuted instantiation: ssu_external.c:dns_name_init Unexecuted instantiation: stats.c:dns_name_init Unexecuted instantiation: transport.c:dns_name_init Unexecuted instantiation: tsig.c:dns_name_init Unexecuted instantiation: unreachcache.c:dns_name_init Unexecuted instantiation: update.c:dns_name_init Unexecuted instantiation: validator.c:dns_name_init Unexecuted instantiation: view.c:dns_name_init Unexecuted instantiation: zt.c:dns_name_init Unexecuted instantiation: deleg.c:dns_name_init Unexecuted instantiation: badcache.c:dns_name_init Unexecuted instantiation: cache.c:dns_name_init Unexecuted instantiation: dst_parse.c:dns_name_init Unexecuted instantiation: gssapictx.c:dns_name_init Unexecuted instantiation: nta.c:dns_name_init Unexecuted instantiation: openssl_link.c:dns_name_init Unexecuted instantiation: order.c:dns_name_init Unexecuted instantiation: rrl.c:dns_name_init Unexecuted instantiation: dns_rdata_fromtext.c:dns_name_init Unexecuted instantiation: dns_qpkey_name.c:dns_name_init Unexecuted instantiation: dns_master_load.c:dns_name_init Unexecuted instantiation: dns_rdata_fromwire_text.c:dns_name_init Unexecuted instantiation: dns_name_fromwire.c:dns_name_init Unexecuted instantiation: old.c:dns_name_init Unexecuted instantiation: isc_lex_getmastertoken.c:dns_name_init Unexecuted instantiation: isc_lex_gettoken.c:dns_name_init Unexecuted instantiation: dns_message_checksig.c:dns_name_init Unexecuted instantiation: dns_name_fromtext_target.c:dns_name_init Unexecuted instantiation: dns_message_parse.c:dns_name_init |
216 | | /*%< |
217 | | * Initialize 'name'. |
218 | | * |
219 | | * Requires: |
220 | | * \li 'name' is not NULL and points to a struct dns_name. |
221 | | * |
222 | | * Ensures: |
223 | | * \li 'name' is a valid name. |
224 | | * \li dns_name_countlabels(name) == 0 |
225 | | * \li dns_name_isabsolute(name) == false |
226 | | */ |
227 | | |
228 | | static inline void |
229 | 28.5k | dns_name_reset(dns_name_t *name) { |
230 | 28.5k | REQUIRE(DNS_NAME_VALID(name)); |
231 | 28.5k | REQUIRE(DNS_NAME_BINDABLE(name)); |
232 | | |
233 | 28.5k | name->ndata = NULL; |
234 | 28.5k | name->length = 0; |
235 | 28.5k | name->attributes.absolute = false; |
236 | 28.5k | if (name->buffer != NULL) { |
237 | 28.5k | isc_buffer_clear(name->buffer); |
238 | 28.5k | } |
239 | 28.5k | } Unexecuted instantiation: dns_qp.c:dns_name_reset Unexecuted instantiation: main.c:dns_name_reset Line | Count | Source | 229 | 496 | dns_name_reset(dns_name_t *name) { | 230 | 496 | REQUIRE(DNS_NAME_VALID(name)); | 231 | 496 | REQUIRE(DNS_NAME_BINDABLE(name)); | 232 | | | 233 | 496 | name->ndata = NULL; | 234 | 496 | name->length = 0; | 235 | 496 | name->attributes.absolute = false; | 236 | 496 | if (name->buffer != NULL) { | 237 | 496 | isc_buffer_clear(name->buffer); | 238 | 496 | } | 239 | 496 | } |
Unexecuted instantiation: fixedname.c:dns_name_reset Unexecuted instantiation: lib.c:dns_name_reset Unexecuted instantiation: name.c:dns_name_reset Unexecuted instantiation: qpzone.c:dns_name_reset Unexecuted instantiation: rdata.c:dns_name_reset Unexecuted instantiation: rdataset.c:dns_name_reset Unexecuted instantiation: rdatavec.c:dns_name_reset Unexecuted instantiation: zone.c:dns_name_reset Unexecuted instantiation: zonefetch.c:dns_name_reset Unexecuted instantiation: zonemgr.c:dns_name_reset Unexecuted instantiation: zoneproperties.c:dns_name_reset Unexecuted instantiation: zoneverify.c:dns_name_reset Unexecuted instantiation: resolver.c:dns_name_reset Unexecuted instantiation: xfrin.c:dns_name_reset Unexecuted instantiation: acl.c:dns_name_reset Unexecuted instantiation: adb.c:dns_name_reset Unexecuted instantiation: catz.c:dns_name_reset Unexecuted instantiation: compress.c:dns_name_reset Unexecuted instantiation: db.c:dns_name_reset Unexecuted instantiation: dbiterator.c:dns_name_reset Unexecuted instantiation: diff.c:dns_name_reset Unexecuted instantiation: dispatch.c:dns_name_reset Unexecuted instantiation: dlz.c:dns_name_reset Unexecuted instantiation: dns64.c:dns_name_reset Unexecuted instantiation: dnssec.c:dns_name_reset Unexecuted instantiation: ds.c:dns_name_reset Unexecuted instantiation: dst_api.c:dns_name_reset Unexecuted instantiation: dyndb.c:dns_name_reset Unexecuted instantiation: ede.c:dns_name_reset Unexecuted instantiation: forward.c:dns_name_reset Unexecuted instantiation: hmac_link.c:dns_name_reset Unexecuted instantiation: ipkeylist.c:dns_name_reset Unexecuted instantiation: iptable.c:dns_name_reset Unexecuted instantiation: journal.c:dns_name_reset Unexecuted instantiation: kasp.c:dns_name_reset Unexecuted instantiation: key.c:dns_name_reset Unexecuted instantiation: keydata.c:dns_name_reset Unexecuted instantiation: keymgr.c:dns_name_reset Unexecuted instantiation: keystore.c:dns_name_reset Unexecuted instantiation: keytable.c:dns_name_reset Unexecuted instantiation: master.c:dns_name_reset Unexecuted instantiation: masterdump.c:dns_name_reset Line | Count | Source | 229 | 28.0k | dns_name_reset(dns_name_t *name) { | 230 | 28.0k | REQUIRE(DNS_NAME_VALID(name)); | 231 | 28.0k | REQUIRE(DNS_NAME_BINDABLE(name)); | 232 | | | 233 | 28.0k | name->ndata = NULL; | 234 | 28.0k | name->length = 0; | 235 | 28.0k | name->attributes.absolute = false; | 236 | 28.0k | if (name->buffer != NULL) { | 237 | 28.0k | isc_buffer_clear(name->buffer); | 238 | 28.0k | } | 239 | 28.0k | } |
Unexecuted instantiation: nametree.c:dns_name_reset Unexecuted instantiation: ncache.c:dns_name_reset Unexecuted instantiation: notify.c:dns_name_reset Unexecuted instantiation: nsec.c:dns_name_reset Unexecuted instantiation: nsec3.c:dns_name_reset Unexecuted instantiation: opensslecdsa_link.c:dns_name_reset Unexecuted instantiation: openssleddsa_link.c:dns_name_reset Unexecuted instantiation: opensslrsa_link.c:dns_name_reset Unexecuted instantiation: peer.c:dns_name_reset Unexecuted instantiation: private.c:dns_name_reset Unexecuted instantiation: qpcache.c:dns_name_reset Unexecuted instantiation: rcode.c:dns_name_reset Unexecuted instantiation: rdatalist.c:dns_name_reset Unexecuted instantiation: rdatasetiter.c:dns_name_reset Unexecuted instantiation: rdataslab.c:dns_name_reset Unexecuted instantiation: remote.c:dns_name_reset Unexecuted instantiation: request.c:dns_name_reset Unexecuted instantiation: rpz.c:dns_name_reset Unexecuted instantiation: rriterator.c:dns_name_reset Unexecuted instantiation: skr.c:dns_name_reset Unexecuted instantiation: soa.c:dns_name_reset Unexecuted instantiation: ssu.c:dns_name_reset Unexecuted instantiation: ssu_external.c:dns_name_reset Unexecuted instantiation: stats.c:dns_name_reset Unexecuted instantiation: transport.c:dns_name_reset Unexecuted instantiation: tsig.c:dns_name_reset Unexecuted instantiation: unreachcache.c:dns_name_reset Unexecuted instantiation: update.c:dns_name_reset Unexecuted instantiation: validator.c:dns_name_reset Unexecuted instantiation: view.c:dns_name_reset Unexecuted instantiation: zt.c:dns_name_reset Unexecuted instantiation: deleg.c:dns_name_reset Unexecuted instantiation: badcache.c:dns_name_reset Unexecuted instantiation: cache.c:dns_name_reset Unexecuted instantiation: dst_parse.c:dns_name_reset Unexecuted instantiation: gssapictx.c:dns_name_reset Unexecuted instantiation: nta.c:dns_name_reset Unexecuted instantiation: openssl_link.c:dns_name_reset Unexecuted instantiation: order.c:dns_name_reset Unexecuted instantiation: rrl.c:dns_name_reset Unexecuted instantiation: dns_rdata_fromtext.c:dns_name_reset Unexecuted instantiation: dns_qpkey_name.c:dns_name_reset Unexecuted instantiation: dns_master_load.c:dns_name_reset Unexecuted instantiation: dns_rdata_fromwire_text.c:dns_name_reset Unexecuted instantiation: dns_name_fromwire.c:dns_name_reset Unexecuted instantiation: old.c:dns_name_reset Unexecuted instantiation: isc_lex_getmastertoken.c:dns_name_reset Unexecuted instantiation: isc_lex_gettoken.c:dns_name_reset Unexecuted instantiation: dns_message_checksig.c:dns_name_reset Unexecuted instantiation: dns_name_fromtext_target.c:dns_name_reset Unexecuted instantiation: dns_message_parse.c:dns_name_reset |
240 | | /*%< |
241 | | * Reinitialize 'name'. |
242 | | * |
243 | | * Notes: |
244 | | * \li This function distinguishes itself from dns_name_init() in two |
245 | | * key ways: |
246 | | * |
247 | | * \li + If any buffer is associated with 'name' (via dns_name_setbuffer() |
248 | | * or by being part of a dns_fixedname_t) the link to the buffer |
249 | | * is retained but the buffer itself is cleared. |
250 | | * |
251 | | * \li + Of the attributes associated with 'name', all are retained except |
252 | | * the absolute flag. |
253 | | * |
254 | | * Requires: |
255 | | * \li 'name' is a valid name. |
256 | | * |
257 | | * Ensures: |
258 | | * \li 'name' is a valid name. |
259 | | * \li dns_name_countlabels(name) == 0 |
260 | | * \li dns_name_isabsolute(name) == false |
261 | | */ |
262 | | |
263 | | static inline void |
264 | 10.6M | dns_name_invalidate(dns_name_t *name) { |
265 | 10.6M | REQUIRE(DNS_NAME_VALID(name)); |
266 | | |
267 | 10.6M | name->magic = 0; |
268 | 10.6M | name->ndata = NULL; |
269 | 10.6M | name->length = 0; |
270 | 10.6M | name->attributes = (struct dns_name_attrs){}; |
271 | 10.6M | name->buffer = NULL; |
272 | 10.6M | ISC_LINK_INIT(name, link); |
273 | 10.6M | } Unexecuted instantiation: dns_qp.c:dns_name_invalidate Unexecuted instantiation: main.c:dns_name_invalidate Unexecuted instantiation: qp.c:dns_name_invalidate Unexecuted instantiation: fixedname.c:dns_name_invalidate Unexecuted instantiation: lib.c:dns_name_invalidate name.c:dns_name_invalidate Line | Count | Source | 264 | 10.6M | dns_name_invalidate(dns_name_t *name) { | 265 | 10.6M | REQUIRE(DNS_NAME_VALID(name)); | 266 | | | 267 | 10.6M | name->magic = 0; | 268 | 10.6M | name->ndata = NULL; | 269 | 10.6M | name->length = 0; | 270 | 10.6M | name->attributes = (struct dns_name_attrs){}; | 271 | 10.6M | name->buffer = NULL; | 272 | 10.6M | ISC_LINK_INIT(name, link); | 273 | 10.6M | } |
Unexecuted instantiation: qpzone.c:dns_name_invalidate Unexecuted instantiation: rdata.c:dns_name_invalidate Unexecuted instantiation: rdataset.c:dns_name_invalidate Unexecuted instantiation: rdatavec.c:dns_name_invalidate Unexecuted instantiation: zone.c:dns_name_invalidate Unexecuted instantiation: zonefetch.c:dns_name_invalidate Unexecuted instantiation: zonemgr.c:dns_name_invalidate Unexecuted instantiation: zoneproperties.c:dns_name_invalidate Unexecuted instantiation: zoneverify.c:dns_name_invalidate Unexecuted instantiation: resolver.c:dns_name_invalidate Unexecuted instantiation: xfrin.c:dns_name_invalidate Unexecuted instantiation: acl.c:dns_name_invalidate Unexecuted instantiation: adb.c:dns_name_invalidate Unexecuted instantiation: catz.c:dns_name_invalidate Unexecuted instantiation: compress.c:dns_name_invalidate Unexecuted instantiation: db.c:dns_name_invalidate Unexecuted instantiation: dbiterator.c:dns_name_invalidate Unexecuted instantiation: diff.c:dns_name_invalidate Unexecuted instantiation: dispatch.c:dns_name_invalidate Unexecuted instantiation: dlz.c:dns_name_invalidate Unexecuted instantiation: dns64.c:dns_name_invalidate Unexecuted instantiation: dnssec.c:dns_name_invalidate Unexecuted instantiation: ds.c:dns_name_invalidate Unexecuted instantiation: dst_api.c:dns_name_invalidate Unexecuted instantiation: dyndb.c:dns_name_invalidate Unexecuted instantiation: ede.c:dns_name_invalidate Unexecuted instantiation: forward.c:dns_name_invalidate Unexecuted instantiation: hmac_link.c:dns_name_invalidate Unexecuted instantiation: ipkeylist.c:dns_name_invalidate Unexecuted instantiation: iptable.c:dns_name_invalidate Unexecuted instantiation: journal.c:dns_name_invalidate Unexecuted instantiation: kasp.c:dns_name_invalidate Unexecuted instantiation: key.c:dns_name_invalidate Unexecuted instantiation: keydata.c:dns_name_invalidate Unexecuted instantiation: keymgr.c:dns_name_invalidate Unexecuted instantiation: keystore.c:dns_name_invalidate Unexecuted instantiation: keytable.c:dns_name_invalidate Unexecuted instantiation: master.c:dns_name_invalidate Unexecuted instantiation: masterdump.c:dns_name_invalidate Unexecuted instantiation: message.c:dns_name_invalidate Unexecuted instantiation: nametree.c:dns_name_invalidate Unexecuted instantiation: ncache.c:dns_name_invalidate Unexecuted instantiation: notify.c:dns_name_invalidate Unexecuted instantiation: nsec.c:dns_name_invalidate Unexecuted instantiation: nsec3.c:dns_name_invalidate Unexecuted instantiation: opensslecdsa_link.c:dns_name_invalidate Unexecuted instantiation: openssleddsa_link.c:dns_name_invalidate Unexecuted instantiation: opensslrsa_link.c:dns_name_invalidate Unexecuted instantiation: peer.c:dns_name_invalidate Unexecuted instantiation: private.c:dns_name_invalidate Unexecuted instantiation: qpcache.c:dns_name_invalidate Unexecuted instantiation: rcode.c:dns_name_invalidate Unexecuted instantiation: rdatalist.c:dns_name_invalidate Unexecuted instantiation: rdatasetiter.c:dns_name_invalidate Unexecuted instantiation: rdataslab.c:dns_name_invalidate Unexecuted instantiation: remote.c:dns_name_invalidate Unexecuted instantiation: request.c:dns_name_invalidate Unexecuted instantiation: rpz.c:dns_name_invalidate Unexecuted instantiation: rriterator.c:dns_name_invalidate Unexecuted instantiation: skr.c:dns_name_invalidate Unexecuted instantiation: soa.c:dns_name_invalidate Unexecuted instantiation: ssu.c:dns_name_invalidate Unexecuted instantiation: ssu_external.c:dns_name_invalidate Unexecuted instantiation: stats.c:dns_name_invalidate Unexecuted instantiation: transport.c:dns_name_invalidate Unexecuted instantiation: tsig.c:dns_name_invalidate Unexecuted instantiation: unreachcache.c:dns_name_invalidate Unexecuted instantiation: update.c:dns_name_invalidate Unexecuted instantiation: validator.c:dns_name_invalidate Unexecuted instantiation: view.c:dns_name_invalidate Unexecuted instantiation: zt.c:dns_name_invalidate Unexecuted instantiation: deleg.c:dns_name_invalidate Unexecuted instantiation: badcache.c:dns_name_invalidate Unexecuted instantiation: cache.c:dns_name_invalidate Unexecuted instantiation: dst_parse.c:dns_name_invalidate Unexecuted instantiation: gssapictx.c:dns_name_invalidate Unexecuted instantiation: nta.c:dns_name_invalidate Unexecuted instantiation: openssl_link.c:dns_name_invalidate Unexecuted instantiation: order.c:dns_name_invalidate Unexecuted instantiation: rrl.c:dns_name_invalidate Unexecuted instantiation: dns_rdata_fromtext.c:dns_name_invalidate Unexecuted instantiation: dns_qpkey_name.c:dns_name_invalidate Unexecuted instantiation: dns_master_load.c:dns_name_invalidate Unexecuted instantiation: dns_rdata_fromwire_text.c:dns_name_invalidate Unexecuted instantiation: dns_name_fromwire.c:dns_name_invalidate Unexecuted instantiation: old.c:dns_name_invalidate Unexecuted instantiation: isc_lex_getmastertoken.c:dns_name_invalidate Unexecuted instantiation: isc_lex_gettoken.c:dns_name_invalidate Unexecuted instantiation: dns_message_checksig.c:dns_name_invalidate Unexecuted instantiation: dns_name_fromtext_target.c:dns_name_invalidate Unexecuted instantiation: dns_message_parse.c:dns_name_invalidate |
274 | | /*%< |
275 | | * Make 'name' invalid. |
276 | | * |
277 | | * Requires: |
278 | | * \li 'name' is a valid name. |
279 | | * |
280 | | * Ensures: |
281 | | * \li If assertion checking is enabled, future attempts to use 'name' |
282 | | * without initializing it will cause an assertion failure. |
283 | | * |
284 | | * \li If the name had a dedicated buffer, that association is ended. |
285 | | */ |
286 | | |
287 | | bool |
288 | | dns_name_isvalid(const dns_name_t *name); |
289 | | /*%< |
290 | | * Check whether 'name' points to a valid dns_name |
291 | | */ |
292 | | |
293 | | /*** |
294 | | *** Dedicated Buffers |
295 | | ***/ |
296 | | |
297 | | static inline void |
298 | 9.95M | dns_name_setbuffer(dns_name_t *name, isc_buffer_t *buffer) { |
299 | 9.95M | REQUIRE(DNS_NAME_VALID(name)); |
300 | 9.95M | REQUIRE((buffer != NULL && name->buffer == NULL) || (buffer == NULL)); |
301 | | |
302 | 9.95M | name->buffer = buffer; |
303 | 9.95M | } Unexecuted instantiation: dns_qp.c:dns_name_setbuffer Unexecuted instantiation: main.c:dns_name_setbuffer Unexecuted instantiation: qp.c:dns_name_setbuffer fixedname.c:dns_name_setbuffer Line | Count | Source | 298 | 9.95M | dns_name_setbuffer(dns_name_t *name, isc_buffer_t *buffer) { | 299 | 9.95M | REQUIRE(DNS_NAME_VALID(name)); | 300 | 9.95M | REQUIRE((buffer != NULL && name->buffer == NULL) || (buffer == NULL)); | 301 | | | 302 | 9.95M | name->buffer = buffer; | 303 | 9.95M | } |
Unexecuted instantiation: lib.c:dns_name_setbuffer Unexecuted instantiation: name.c:dns_name_setbuffer Unexecuted instantiation: qpzone.c:dns_name_setbuffer Unexecuted instantiation: rdata.c:dns_name_setbuffer Unexecuted instantiation: rdataset.c:dns_name_setbuffer Unexecuted instantiation: rdatavec.c:dns_name_setbuffer Unexecuted instantiation: zone.c:dns_name_setbuffer Unexecuted instantiation: zonefetch.c:dns_name_setbuffer Unexecuted instantiation: zonemgr.c:dns_name_setbuffer Unexecuted instantiation: zoneproperties.c:dns_name_setbuffer Unexecuted instantiation: zoneverify.c:dns_name_setbuffer Unexecuted instantiation: resolver.c:dns_name_setbuffer Unexecuted instantiation: xfrin.c:dns_name_setbuffer Unexecuted instantiation: acl.c:dns_name_setbuffer Unexecuted instantiation: adb.c:dns_name_setbuffer Unexecuted instantiation: catz.c:dns_name_setbuffer Unexecuted instantiation: compress.c:dns_name_setbuffer Unexecuted instantiation: db.c:dns_name_setbuffer Unexecuted instantiation: dbiterator.c:dns_name_setbuffer Unexecuted instantiation: diff.c:dns_name_setbuffer Unexecuted instantiation: dispatch.c:dns_name_setbuffer Unexecuted instantiation: dlz.c:dns_name_setbuffer Unexecuted instantiation: dns64.c:dns_name_setbuffer Unexecuted instantiation: dnssec.c:dns_name_setbuffer Unexecuted instantiation: ds.c:dns_name_setbuffer Unexecuted instantiation: dst_api.c:dns_name_setbuffer Unexecuted instantiation: dyndb.c:dns_name_setbuffer Unexecuted instantiation: ede.c:dns_name_setbuffer Unexecuted instantiation: forward.c:dns_name_setbuffer Unexecuted instantiation: hmac_link.c:dns_name_setbuffer Unexecuted instantiation: ipkeylist.c:dns_name_setbuffer Unexecuted instantiation: iptable.c:dns_name_setbuffer Unexecuted instantiation: journal.c:dns_name_setbuffer Unexecuted instantiation: kasp.c:dns_name_setbuffer Unexecuted instantiation: key.c:dns_name_setbuffer Unexecuted instantiation: keydata.c:dns_name_setbuffer Unexecuted instantiation: keymgr.c:dns_name_setbuffer Unexecuted instantiation: keystore.c:dns_name_setbuffer Unexecuted instantiation: keytable.c:dns_name_setbuffer Unexecuted instantiation: master.c:dns_name_setbuffer Unexecuted instantiation: masterdump.c:dns_name_setbuffer Unexecuted instantiation: message.c:dns_name_setbuffer Unexecuted instantiation: nametree.c:dns_name_setbuffer Unexecuted instantiation: ncache.c:dns_name_setbuffer Unexecuted instantiation: notify.c:dns_name_setbuffer Unexecuted instantiation: nsec.c:dns_name_setbuffer Unexecuted instantiation: nsec3.c:dns_name_setbuffer Unexecuted instantiation: opensslecdsa_link.c:dns_name_setbuffer Unexecuted instantiation: openssleddsa_link.c:dns_name_setbuffer Unexecuted instantiation: opensslrsa_link.c:dns_name_setbuffer Unexecuted instantiation: peer.c:dns_name_setbuffer Unexecuted instantiation: private.c:dns_name_setbuffer Unexecuted instantiation: qpcache.c:dns_name_setbuffer Unexecuted instantiation: rcode.c:dns_name_setbuffer Unexecuted instantiation: rdatalist.c:dns_name_setbuffer Unexecuted instantiation: rdatasetiter.c:dns_name_setbuffer Unexecuted instantiation: rdataslab.c:dns_name_setbuffer Unexecuted instantiation: remote.c:dns_name_setbuffer Unexecuted instantiation: request.c:dns_name_setbuffer Unexecuted instantiation: rpz.c:dns_name_setbuffer Unexecuted instantiation: rriterator.c:dns_name_setbuffer Unexecuted instantiation: skr.c:dns_name_setbuffer Unexecuted instantiation: soa.c:dns_name_setbuffer Unexecuted instantiation: ssu.c:dns_name_setbuffer Unexecuted instantiation: ssu_external.c:dns_name_setbuffer Unexecuted instantiation: stats.c:dns_name_setbuffer Unexecuted instantiation: transport.c:dns_name_setbuffer Unexecuted instantiation: tsig.c:dns_name_setbuffer Unexecuted instantiation: unreachcache.c:dns_name_setbuffer Unexecuted instantiation: update.c:dns_name_setbuffer Unexecuted instantiation: validator.c:dns_name_setbuffer Unexecuted instantiation: view.c:dns_name_setbuffer Unexecuted instantiation: zt.c:dns_name_setbuffer Unexecuted instantiation: deleg.c:dns_name_setbuffer Unexecuted instantiation: badcache.c:dns_name_setbuffer Unexecuted instantiation: cache.c:dns_name_setbuffer Unexecuted instantiation: dst_parse.c:dns_name_setbuffer Unexecuted instantiation: gssapictx.c:dns_name_setbuffer Unexecuted instantiation: nta.c:dns_name_setbuffer Unexecuted instantiation: openssl_link.c:dns_name_setbuffer Unexecuted instantiation: order.c:dns_name_setbuffer Unexecuted instantiation: rrl.c:dns_name_setbuffer Unexecuted instantiation: dns_rdata_fromtext.c:dns_name_setbuffer Unexecuted instantiation: dns_qpkey_name.c:dns_name_setbuffer Unexecuted instantiation: dns_master_load.c:dns_name_setbuffer Unexecuted instantiation: dns_rdata_fromwire_text.c:dns_name_setbuffer Unexecuted instantiation: dns_name_fromwire.c:dns_name_setbuffer Unexecuted instantiation: old.c:dns_name_setbuffer Unexecuted instantiation: isc_lex_getmastertoken.c:dns_name_setbuffer Unexecuted instantiation: isc_lex_gettoken.c:dns_name_setbuffer Unexecuted instantiation: dns_message_checksig.c:dns_name_setbuffer Unexecuted instantiation: dns_name_fromtext_target.c:dns_name_setbuffer Unexecuted instantiation: dns_message_parse.c:dns_name_setbuffer |
304 | | /*%< |
305 | | * Dedicate a buffer for use with 'name'. |
306 | | * |
307 | | * Notes: |
308 | | * \li Specification of a target buffer in dns_name_fromwire() and |
309 | | * dns_name_fromtext() is optional if 'name' has a dedicated buffer. |
310 | | * The target name in dns_name_concatenate() must have a dedicated |
311 | | * buffer. |
312 | | * |
313 | | * \li The caller must not write to buffer until the name has been |
314 | | * invalidated or is otherwise known not to be in use. |
315 | | * |
316 | | * \li If buffer is NULL and the name previously had a dedicated buffer, |
317 | | * than that buffer is no longer dedicated to use with this name. |
318 | | * The caller is responsible for ensuring that the storage used by |
319 | | * the name remains valid. |
320 | | * |
321 | | * Requires: |
322 | | * \li 'name' is a valid name. |
323 | | * |
324 | | * \li 'buffer' is a valid binary buffer and 'name' doesn't have a |
325 | | * dedicated buffer already, or 'buffer' is NULL. |
326 | | */ |
327 | | |
328 | | bool |
329 | | dns_name_hasbuffer(const dns_name_t *name); |
330 | | /*%< |
331 | | * Does 'name' have a dedicated buffer? |
332 | | * |
333 | | * Requires: |
334 | | * \li 'name' is a valid name. |
335 | | * |
336 | | * Returns: |
337 | | * \li true 'name' has a dedicated buffer. |
338 | | * \li false 'name' does not have a dedicated buffer. |
339 | | */ |
340 | | |
341 | | /*** |
342 | | *** Properties |
343 | | ***/ |
344 | | |
345 | | bool |
346 | | dns_name_isabsolute(const dns_name_t *name); |
347 | | /*%< |
348 | | * Does 'name' end in the root label? |
349 | | * |
350 | | * Requires: |
351 | | * \li 'name' is a valid name |
352 | | * |
353 | | * Returns: |
354 | | * \li TRUE The last label in 'name' is the root label. |
355 | | * \li FALSE The last label in 'name' is not the root label. |
356 | | */ |
357 | | |
358 | | bool |
359 | | dns_name_iswildcard(const dns_name_t *name); |
360 | | /*%< |
361 | | * Is 'name' a wildcard name? |
362 | | * |
363 | | * Requires: |
364 | | * \li 'name' is a valid name |
365 | | * |
366 | | * \li dns_name_countlabels(name) > 0 |
367 | | * |
368 | | * Returns: |
369 | | * \li TRUE The least significant label of 'name' is '*'. |
370 | | * \li FALSE The least significant label of 'name' is not '*'. |
371 | | */ |
372 | | |
373 | | uint32_t |
374 | | dns_name_hash(const dns_name_t *name); |
375 | | /*%< |
376 | | * Provide a hash value for 'name'. |
377 | | * |
378 | | * Note: This function always takes into account of the entire name to calculate |
379 | | * the hash value. The names which differ only in case will have the same hash |
380 | | * value. |
381 | | * |
382 | | * Requires: |
383 | | *\li 'name' is a valid name |
384 | | * |
385 | | * Returns: |
386 | | *\li A hash value |
387 | | */ |
388 | | |
389 | | /* |
390 | | *** Comparisons |
391 | | ***/ |
392 | | |
393 | | dns_namereln_t |
394 | | dns_name_fullcompare(const dns_name_t *name1, const dns_name_t *name2, |
395 | | int *orderp, unsigned int *nlabelsp); |
396 | | /*%< |
397 | | * Determine the relative ordering under the DNSSEC order relation of |
398 | | * 'name1' and 'name2', and also determine the hierarchical |
399 | | * relationship of the names. |
400 | | * |
401 | | * Note: It makes no sense for one of the names to be relative and the |
402 | | * other absolute. If both names are relative, then to be meaningfully |
403 | | * compared the caller must ensure that they are both relative to the |
404 | | * same domain. |
405 | | * |
406 | | * Requires: |
407 | | *\li 'name1' is a valid name |
408 | | * |
409 | | *\li dns_name_countlabels(name1) > 0 |
410 | | * |
411 | | *\li 'name2' is a valid name |
412 | | * |
413 | | *\li dns_name_countlabels(name2) > 0 |
414 | | * |
415 | | *\li orderp and nlabelsp are valid pointers. |
416 | | * |
417 | | *\li Either name1 is absolute and name2 is absolute, or neither is. |
418 | | * |
419 | | * Ensures: |
420 | | * |
421 | | *\li *orderp is < 0 if name1 < name2, 0 if name1 = name2, > 0 if |
422 | | * name1 > name2. |
423 | | * |
424 | | *\li *nlabelsp is the number of common significant labels. |
425 | | * |
426 | | * Returns: |
427 | | *\li dns_namereln_none There's no hierarchical relationship |
428 | | * between name1 and name2. |
429 | | *\li dns_namereln_contains name1 properly contains name2; i.e. |
430 | | * name2 is a proper subdomain of name1. |
431 | | *\li dns_namereln_subdomain name1 is a proper subdomain of name2. |
432 | | *\li dns_namereln_equal name1 and name2 are equal. |
433 | | *\li dns_namereln_commonancestor name1 and name2 share a common |
434 | | * ancestor. |
435 | | */ |
436 | | |
437 | | int |
438 | | dns_name_compare(const dns_name_t *name1, const dns_name_t *name2); |
439 | | /*%< |
440 | | * Determine the relative ordering under the DNSSEC order relation of |
441 | | * 'name1' and 'name2'. |
442 | | * |
443 | | * Note: It makes no sense for one of the names to be relative and the |
444 | | * other absolute. If both names are relative, then to be meaningfully |
445 | | * compared the caller must ensure that they are both relative to the |
446 | | * same domain. |
447 | | * |
448 | | * Requires: |
449 | | * \li 'name1' is a valid name |
450 | | * |
451 | | * \li 'name2' is a valid name |
452 | | * |
453 | | * \li Either name1 is absolute and name2 is absolute, or neither is. |
454 | | * |
455 | | * Returns: |
456 | | * \li < 0 'name1' is less than 'name2' |
457 | | * \li 0 'name1' is equal to 'name2' |
458 | | * \li > 0 'name1' is greater than 'name2' |
459 | | */ |
460 | | |
461 | | bool |
462 | | dns_name_equal(const dns_name_t *name1, const dns_name_t *name2); |
463 | | /*%< |
464 | | * Are 'name1' and 'name2' equal? |
465 | | * |
466 | | * Notes: |
467 | | * \li Because it only needs to test for equality, dns_name_equal() can be |
468 | | * significantly faster than dns_name_fullcompare() or dns_name_compare(). |
469 | | * |
470 | | * \li It makes no sense for one of the names to be relative and the |
471 | | * other absolute. If both names are relative, then to be meaningfully |
472 | | * compared the caller must ensure that they are both relative to the |
473 | | * same domain. |
474 | | * |
475 | | * Requires: |
476 | | * \li 'name1' is a valid name |
477 | | * |
478 | | * \li 'name2' is a valid name |
479 | | * |
480 | | * \li Either name1 is absolute and name2 is absolute, or neither is. |
481 | | * |
482 | | * Returns: |
483 | | * \li true 'name1' and 'name2' are equal |
484 | | * \li false 'name1' and 'name2' are not equal |
485 | | */ |
486 | | |
487 | | bool |
488 | | dns_name_caseequal(const dns_name_t *name1, const dns_name_t *name2); |
489 | | /*%< |
490 | | * Case sensitive version of dns_name_equal(). |
491 | | */ |
492 | | |
493 | | int |
494 | | dns_name_rdatacompare(const dns_name_t *name1, const dns_name_t *name2); |
495 | | /*%< |
496 | | * Compare two names as if they are part of rdata in DNSSEC canonical |
497 | | * form. |
498 | | * |
499 | | * Requires: |
500 | | * \li 'name1' is a valid absolute name |
501 | | * |
502 | | * \li dns_name_countlabels(name1) > 0 |
503 | | * |
504 | | * \li 'name2' is a valid absolute name |
505 | | * |
506 | | * \li dns_name_countlabels(name2) > 0 |
507 | | * |
508 | | * Returns: |
509 | | * \li < 0 'name1' is less than 'name2' |
510 | | * \li 0 'name1' is equal to 'name2' |
511 | | * \li > 0 'name1' is greater than 'name2' |
512 | | */ |
513 | | |
514 | | bool |
515 | | dns_name_issubdomain(const dns_name_t *name1, const dns_name_t *name2); |
516 | | /*%< |
517 | | * Is 'name1' a subdomain of 'name2'? |
518 | | * |
519 | | * Notes: |
520 | | * \li name1 is a subdomain of name2 if name1 is contained in name2, or |
521 | | * name1 equals name2. |
522 | | * |
523 | | * \li It makes no sense for one of the names to be relative and the |
524 | | * other absolute. If both names are relative, then to be meaningfully |
525 | | * compared the caller must ensure that they are both relative to the |
526 | | * same domain. |
527 | | * |
528 | | * Requires: |
529 | | * \li 'name1' is a valid name |
530 | | * |
531 | | * \li 'name2' is a valid name |
532 | | * |
533 | | * \li Either name1 is absolute and name2 is absolute, or neither is. |
534 | | * |
535 | | * Returns: |
536 | | * \li TRUE 'name1' is a subdomain of 'name2' |
537 | | * \li FALSE 'name1' is not a subdomain of 'name2' |
538 | | */ |
539 | | |
540 | | bool |
541 | | dns_name_matcheswildcard(const dns_name_t *name, const dns_name_t *wname); |
542 | | /*%< |
543 | | * Does 'name' match the wildcard specified in 'wname'? |
544 | | * |
545 | | * Notes: |
546 | | * \li name matches the wildcard specified in wname if all labels |
547 | | * following the wildcard in wname are identical to the same number |
548 | | * of labels at the end of name. |
549 | | * |
550 | | * \li It makes no sense for one of the names to be relative and the |
551 | | * other absolute. If both names are relative, then to be meaningfully |
552 | | * compared the caller must ensure that they are both relative to the |
553 | | * same domain. |
554 | | * |
555 | | * Requires: |
556 | | * \li 'name' is a valid name |
557 | | * |
558 | | * \li dns_name_countlabels(name) > 0 |
559 | | * |
560 | | * \li 'wname' is a valid name |
561 | | * |
562 | | * \li dns_name_countlabels(wname) > 0 |
563 | | * |
564 | | * \li dns_name_iswildcard(wname) is true |
565 | | * |
566 | | * \li Either name is absolute and wname is absolute, or neither is. |
567 | | * |
568 | | * Returns: |
569 | | * \li TRUE 'name' matches the wildcard specified in 'wname' |
570 | | * \li FALSE 'name' does not match the wildcard specified in 'wname' |
571 | | */ |
572 | | |
573 | | /*** |
574 | | *** Labels |
575 | | ***/ |
576 | | |
577 | | uint8_t |
578 | | dns_name_offsets(const dns_name_t *name, dns_offsets_t offsets); |
579 | | /*%< |
580 | | * Returns the number of the labels in the DNS name and optionally fills their |
581 | | * offsets into the table. |
582 | | * |
583 | | * Requires: |
584 | | *\li 'name' is a valid DNS name |
585 | | * |
586 | | * Returns: |
587 | | *\li number of labels in the DNS name |
588 | | * |
589 | | * Note: |
590 | | *\li if the 'offsets' is non-NULL, it will fill the offsets of |
591 | | * individual labels in the name |
592 | | */ |
593 | | |
594 | | static inline uint8_t |
595 | 39.1M | dns_name_countlabels(const dns_name_t *name) { |
596 | 39.1M | REQUIRE(DNS_NAME_VALID(name)); |
597 | | |
598 | 39.1M | return dns_name_offsets(name, NULL); |
599 | 39.1M | } Unexecuted instantiation: dns_qp.c:dns_name_countlabels Unexecuted instantiation: main.c:dns_name_countlabels Unexecuted instantiation: qp.c:dns_name_countlabels Unexecuted instantiation: fixedname.c:dns_name_countlabels Unexecuted instantiation: lib.c:dns_name_countlabels name.c:dns_name_countlabels Line | Count | Source | 595 | 14.9M | dns_name_countlabels(const dns_name_t *name) { | 596 | 14.9M | REQUIRE(DNS_NAME_VALID(name)); | 597 | | | 598 | | return dns_name_offsets(name, NULL); | 599 | 14.9M | } |
qpzone.c:dns_name_countlabels Line | Count | Source | 595 | 24.1M | dns_name_countlabels(const dns_name_t *name) { | 596 | 24.1M | REQUIRE(DNS_NAME_VALID(name)); | 597 | | | 598 | | return dns_name_offsets(name, NULL); | 599 | 24.1M | } |
Unexecuted instantiation: rdata.c:dns_name_countlabels Unexecuted instantiation: rdataset.c:dns_name_countlabels Unexecuted instantiation: rdatavec.c:dns_name_countlabels Unexecuted instantiation: zone.c:dns_name_countlabels Unexecuted instantiation: zonefetch.c:dns_name_countlabels Unexecuted instantiation: zonemgr.c:dns_name_countlabels Unexecuted instantiation: zoneproperties.c:dns_name_countlabels Unexecuted instantiation: zoneverify.c:dns_name_countlabels Unexecuted instantiation: resolver.c:dns_name_countlabels Unexecuted instantiation: xfrin.c:dns_name_countlabels Unexecuted instantiation: acl.c:dns_name_countlabels Unexecuted instantiation: adb.c:dns_name_countlabels Unexecuted instantiation: catz.c:dns_name_countlabels Unexecuted instantiation: compress.c:dns_name_countlabels Unexecuted instantiation: db.c:dns_name_countlabels Unexecuted instantiation: dbiterator.c:dns_name_countlabels Unexecuted instantiation: diff.c:dns_name_countlabels Unexecuted instantiation: dispatch.c:dns_name_countlabels Unexecuted instantiation: dlz.c:dns_name_countlabels Unexecuted instantiation: dns64.c:dns_name_countlabels Unexecuted instantiation: dnssec.c:dns_name_countlabels Unexecuted instantiation: ds.c:dns_name_countlabels Unexecuted instantiation: dst_api.c:dns_name_countlabels Unexecuted instantiation: dyndb.c:dns_name_countlabels Unexecuted instantiation: ede.c:dns_name_countlabels Unexecuted instantiation: forward.c:dns_name_countlabels Unexecuted instantiation: hmac_link.c:dns_name_countlabels Unexecuted instantiation: ipkeylist.c:dns_name_countlabels Unexecuted instantiation: iptable.c:dns_name_countlabels Unexecuted instantiation: journal.c:dns_name_countlabels Unexecuted instantiation: kasp.c:dns_name_countlabels Unexecuted instantiation: key.c:dns_name_countlabels Unexecuted instantiation: keydata.c:dns_name_countlabels Unexecuted instantiation: keymgr.c:dns_name_countlabels Unexecuted instantiation: keystore.c:dns_name_countlabels Unexecuted instantiation: keytable.c:dns_name_countlabels Unexecuted instantiation: master.c:dns_name_countlabels Unexecuted instantiation: masterdump.c:dns_name_countlabels message.c:dns_name_countlabels Line | Count | Source | 595 | 3.03k | dns_name_countlabels(const dns_name_t *name) { | 596 | 3.03k | REQUIRE(DNS_NAME_VALID(name)); | 597 | | | 598 | | return dns_name_offsets(name, NULL); | 599 | 3.03k | } |
Unexecuted instantiation: nametree.c:dns_name_countlabels Unexecuted instantiation: ncache.c:dns_name_countlabels Unexecuted instantiation: notify.c:dns_name_countlabels Unexecuted instantiation: nsec.c:dns_name_countlabels Unexecuted instantiation: nsec3.c:dns_name_countlabels Unexecuted instantiation: opensslecdsa_link.c:dns_name_countlabels Unexecuted instantiation: openssleddsa_link.c:dns_name_countlabels Unexecuted instantiation: opensslrsa_link.c:dns_name_countlabels Unexecuted instantiation: peer.c:dns_name_countlabels Unexecuted instantiation: private.c:dns_name_countlabels Unexecuted instantiation: qpcache.c:dns_name_countlabels Unexecuted instantiation: rcode.c:dns_name_countlabels Unexecuted instantiation: rdatalist.c:dns_name_countlabels Unexecuted instantiation: rdatasetiter.c:dns_name_countlabels Unexecuted instantiation: rdataslab.c:dns_name_countlabels Unexecuted instantiation: remote.c:dns_name_countlabels Unexecuted instantiation: request.c:dns_name_countlabels Unexecuted instantiation: rpz.c:dns_name_countlabels Unexecuted instantiation: rriterator.c:dns_name_countlabels Unexecuted instantiation: skr.c:dns_name_countlabels Unexecuted instantiation: soa.c:dns_name_countlabels Unexecuted instantiation: ssu.c:dns_name_countlabels Unexecuted instantiation: ssu_external.c:dns_name_countlabels Unexecuted instantiation: stats.c:dns_name_countlabels Unexecuted instantiation: transport.c:dns_name_countlabels Unexecuted instantiation: tsig.c:dns_name_countlabels Unexecuted instantiation: unreachcache.c:dns_name_countlabels Unexecuted instantiation: update.c:dns_name_countlabels Unexecuted instantiation: validator.c:dns_name_countlabels Unexecuted instantiation: view.c:dns_name_countlabels Unexecuted instantiation: zt.c:dns_name_countlabels Unexecuted instantiation: deleg.c:dns_name_countlabels Unexecuted instantiation: badcache.c:dns_name_countlabels Unexecuted instantiation: cache.c:dns_name_countlabels Unexecuted instantiation: dst_parse.c:dns_name_countlabels Unexecuted instantiation: gssapictx.c:dns_name_countlabels Unexecuted instantiation: nta.c:dns_name_countlabels Unexecuted instantiation: openssl_link.c:dns_name_countlabels Unexecuted instantiation: order.c:dns_name_countlabels Unexecuted instantiation: rrl.c:dns_name_countlabels Unexecuted instantiation: dns_rdata_fromtext.c:dns_name_countlabels Unexecuted instantiation: dns_qpkey_name.c:dns_name_countlabels Unexecuted instantiation: dns_master_load.c:dns_name_countlabels Unexecuted instantiation: dns_rdata_fromwire_text.c:dns_name_countlabels Unexecuted instantiation: dns_name_fromwire.c:dns_name_countlabels Unexecuted instantiation: old.c:dns_name_countlabels Unexecuted instantiation: isc_lex_getmastertoken.c:dns_name_countlabels Unexecuted instantiation: isc_lex_gettoken.c:dns_name_countlabels Unexecuted instantiation: dns_message_checksig.c:dns_name_countlabels Unexecuted instantiation: dns_name_fromtext_target.c:dns_name_countlabels Unexecuted instantiation: dns_message_parse.c:dns_name_countlabels |
600 | | /*%< |
601 | | * How many labels does 'name' have? |
602 | | * |
603 | | * Notes: |
604 | | * \li In this case, as in other places, a 'label' is an ordinary label. |
605 | | * |
606 | | * Requires: |
607 | | * \li 'name' is a valid name |
608 | | * |
609 | | * Ensures: |
610 | | * \li The result is <= 128. |
611 | | * |
612 | | * Returns: |
613 | | * \li The number of labels in 'name'. |
614 | | */ |
615 | | |
616 | | void |
617 | | dns_name_getlabel(const dns_name_t *name, unsigned int n, dns_label_t *label); |
618 | | /*%< |
619 | | * Make 'label' refer to the 'n'th least significant label of 'name'. |
620 | | * |
621 | | * Notes: |
622 | | * \li Numbering starts at 0. |
623 | | * |
624 | | * \li Given "rc.vix.com.", the label 0 is "rc", and label 3 is the |
625 | | * root label. |
626 | | * |
627 | | * \li 'label' refers to the same memory as 'name', so 'name' must not |
628 | | * be changed while 'label' is still in use. |
629 | | * |
630 | | * Requires: |
631 | | * \li n < dns_name_countlabels(name) |
632 | | */ |
633 | | |
634 | | void |
635 | | dns_name_getlabelsequence(const dns_name_t *source, unsigned int first, |
636 | | unsigned int n, dns_name_t *target); |
637 | | /*%< |
638 | | * Make 'target' refer to the 'n' labels including and following 'first' |
639 | | * in 'source'. |
640 | | * |
641 | | * Notes: |
642 | | * \li Numbering starts at 0. |
643 | | * |
644 | | * \li Given "rc.vix.com.", the label 0 is "rc", and label 3 is the |
645 | | * root label. |
646 | | * |
647 | | * \li 'target' refers to the same memory as 'source', so 'source' |
648 | | * must not be changed while 'target' is still in use. |
649 | | * |
650 | | * Requires: |
651 | | * \li 'source' and 'target' are valid names. |
652 | | * |
653 | | * \li first < dns_name_countlabels(name) |
654 | | * |
655 | | * \li first + n <= dns_name_countlabels(name) |
656 | | */ |
657 | | |
658 | | void |
659 | | dns_name_clone(const dns_name_t *source, dns_name_t *target); |
660 | | /*%< |
661 | | * Make 'target' refer to the same name as 'source'. |
662 | | * |
663 | | * Notes: |
664 | | * |
665 | | * \li 'target' refers to the same memory as 'source', so 'source' |
666 | | * must not be changed or freed while 'target' is still in use. |
667 | | * |
668 | | * \li This call is functionally equivalent to: |
669 | | * |
670 | | * \code |
671 | | * dns_name_getlabelsequence(source, 0, |
672 | | * dns_name_countlabels(source), |
673 | | * target); |
674 | | * \endcode |
675 | | * |
676 | | * but is more efficient. Also, dns_name_clone() works even if 'source' |
677 | | * is empty. |
678 | | * |
679 | | * Requires: |
680 | | * |
681 | | * \li 'source' is a valid name. |
682 | | * |
683 | | * \li 'target' is a valid name that is not read-only. |
684 | | */ |
685 | | |
686 | | /*** |
687 | | *** Conversions |
688 | | ***/ |
689 | | |
690 | | void |
691 | | dns_name_fromregion(dns_name_t *name, const isc_region_t *r); |
692 | | /*%< |
693 | | * Make 'name' refer to region 'r'. |
694 | | * |
695 | | * Note: |
696 | | * \li If the conversion encounters a root label before the end of the |
697 | | * region the conversion stops and the length is set to the length |
698 | | * so far converted. A maximum of 255 bytes is converted. |
699 | | * |
700 | | * Requires: |
701 | | * \li The data in 'r' is a sequence of one or more type 00 labels. |
702 | | */ |
703 | | |
704 | | static inline void |
705 | 35.3k | dns_name_toregion(const dns_name_t *name, isc_region_t *r) { |
706 | 35.3k | REQUIRE(DNS_NAME_VALID(name)); |
707 | 35.3k | REQUIRE(r != NULL); |
708 | | |
709 | 35.3k | r->base = name->ndata; |
710 | 35.3k | r->length = name->length; |
711 | 35.3k | } Unexecuted instantiation: dns_qp.c:dns_name_toregion Unexecuted instantiation: main.c:dns_name_toregion Unexecuted instantiation: qp.c:dns_name_toregion Unexecuted instantiation: fixedname.c:dns_name_toregion Unexecuted instantiation: lib.c:dns_name_toregion Unexecuted instantiation: name.c:dns_name_toregion Unexecuted instantiation: qpzone.c:dns_name_toregion Unexecuted instantiation: rdata.c:dns_name_toregion Unexecuted instantiation: rdataset.c:dns_name_toregion Unexecuted instantiation: rdatavec.c:dns_name_toregion Unexecuted instantiation: zone.c:dns_name_toregion Unexecuted instantiation: zonefetch.c:dns_name_toregion Unexecuted instantiation: zonemgr.c:dns_name_toregion Unexecuted instantiation: zoneproperties.c:dns_name_toregion Unexecuted instantiation: zoneverify.c:dns_name_toregion Unexecuted instantiation: resolver.c:dns_name_toregion Unexecuted instantiation: xfrin.c:dns_name_toregion Unexecuted instantiation: acl.c:dns_name_toregion Unexecuted instantiation: adb.c:dns_name_toregion Unexecuted instantiation: catz.c:dns_name_toregion Unexecuted instantiation: compress.c:dns_name_toregion Unexecuted instantiation: db.c:dns_name_toregion Unexecuted instantiation: dbiterator.c:dns_name_toregion Unexecuted instantiation: diff.c:dns_name_toregion Unexecuted instantiation: dispatch.c:dns_name_toregion Unexecuted instantiation: dlz.c:dns_name_toregion Unexecuted instantiation: dns64.c:dns_name_toregion Unexecuted instantiation: dnssec.c:dns_name_toregion Unexecuted instantiation: ds.c:dns_name_toregion Unexecuted instantiation: dst_api.c:dns_name_toregion Unexecuted instantiation: dyndb.c:dns_name_toregion Unexecuted instantiation: ede.c:dns_name_toregion Unexecuted instantiation: forward.c:dns_name_toregion Unexecuted instantiation: hmac_link.c:dns_name_toregion Unexecuted instantiation: ipkeylist.c:dns_name_toregion Unexecuted instantiation: iptable.c:dns_name_toregion Unexecuted instantiation: journal.c:dns_name_toregion Unexecuted instantiation: kasp.c:dns_name_toregion Unexecuted instantiation: key.c:dns_name_toregion Unexecuted instantiation: keydata.c:dns_name_toregion Unexecuted instantiation: keymgr.c:dns_name_toregion Unexecuted instantiation: keystore.c:dns_name_toregion Unexecuted instantiation: keytable.c:dns_name_toregion master.c:dns_name_toregion Line | Count | Source | 705 | 35.2k | dns_name_toregion(const dns_name_t *name, isc_region_t *r) { | 706 | 35.2k | REQUIRE(DNS_NAME_VALID(name)); | 707 | 35.2k | REQUIRE(r != NULL); | 708 | | | 709 | 35.2k | r->base = name->ndata; | 710 | 35.2k | r->length = name->length; | 711 | 35.2k | } |
Unexecuted instantiation: masterdump.c:dns_name_toregion Unexecuted instantiation: message.c:dns_name_toregion Unexecuted instantiation: nametree.c:dns_name_toregion Unexecuted instantiation: ncache.c:dns_name_toregion Unexecuted instantiation: notify.c:dns_name_toregion Unexecuted instantiation: nsec.c:dns_name_toregion Unexecuted instantiation: nsec3.c:dns_name_toregion Unexecuted instantiation: opensslecdsa_link.c:dns_name_toregion Unexecuted instantiation: openssleddsa_link.c:dns_name_toregion Unexecuted instantiation: opensslrsa_link.c:dns_name_toregion Unexecuted instantiation: peer.c:dns_name_toregion Unexecuted instantiation: private.c:dns_name_toregion Unexecuted instantiation: qpcache.c:dns_name_toregion Unexecuted instantiation: rcode.c:dns_name_toregion Unexecuted instantiation: rdatalist.c:dns_name_toregion Unexecuted instantiation: rdatasetiter.c:dns_name_toregion Unexecuted instantiation: rdataslab.c:dns_name_toregion Unexecuted instantiation: remote.c:dns_name_toregion Unexecuted instantiation: request.c:dns_name_toregion Unexecuted instantiation: rpz.c:dns_name_toregion Unexecuted instantiation: rriterator.c:dns_name_toregion Unexecuted instantiation: skr.c:dns_name_toregion Unexecuted instantiation: soa.c:dns_name_toregion Unexecuted instantiation: ssu.c:dns_name_toregion Unexecuted instantiation: ssu_external.c:dns_name_toregion Unexecuted instantiation: stats.c:dns_name_toregion Unexecuted instantiation: transport.c:dns_name_toregion Line | Count | Source | 705 | 92 | dns_name_toregion(const dns_name_t *name, isc_region_t *r) { | 706 | 92 | REQUIRE(DNS_NAME_VALID(name)); | 707 | 92 | REQUIRE(r != NULL); | 708 | | | 709 | 92 | r->base = name->ndata; | 710 | 92 | r->length = name->length; | 711 | 92 | } |
Unexecuted instantiation: unreachcache.c:dns_name_toregion Unexecuted instantiation: update.c:dns_name_toregion Unexecuted instantiation: validator.c:dns_name_toregion Unexecuted instantiation: view.c:dns_name_toregion Unexecuted instantiation: zt.c:dns_name_toregion Unexecuted instantiation: deleg.c:dns_name_toregion Unexecuted instantiation: badcache.c:dns_name_toregion Unexecuted instantiation: cache.c:dns_name_toregion Unexecuted instantiation: dst_parse.c:dns_name_toregion Unexecuted instantiation: gssapictx.c:dns_name_toregion Unexecuted instantiation: nta.c:dns_name_toregion Unexecuted instantiation: openssl_link.c:dns_name_toregion Unexecuted instantiation: order.c:dns_name_toregion Unexecuted instantiation: rrl.c:dns_name_toregion Unexecuted instantiation: dns_rdata_fromtext.c:dns_name_toregion Unexecuted instantiation: dns_qpkey_name.c:dns_name_toregion Unexecuted instantiation: dns_master_load.c:dns_name_toregion Unexecuted instantiation: dns_rdata_fromwire_text.c:dns_name_toregion Unexecuted instantiation: dns_name_fromwire.c:dns_name_toregion Unexecuted instantiation: old.c:dns_name_toregion Unexecuted instantiation: isc_lex_getmastertoken.c:dns_name_toregion Unexecuted instantiation: isc_lex_gettoken.c:dns_name_toregion Unexecuted instantiation: dns_message_checksig.c:dns_name_toregion Unexecuted instantiation: dns_name_fromtext_target.c:dns_name_toregion Unexecuted instantiation: dns_message_parse.c:dns_name_toregion |
712 | | /*%< |
713 | | * Make 'r' refer to 'name'. |
714 | | * |
715 | | * Requires: |
716 | | * |
717 | | * \li 'name' is a valid name. |
718 | | * |
719 | | * \li 'r' is a valid region. |
720 | | */ |
721 | | |
722 | | isc_result_t |
723 | | dns_name_fromwire(dns_name_t *name, isc_buffer_t *source, dns_decompress_t dctx, |
724 | | isc_buffer_t *target); |
725 | | /*%< |
726 | | * Copy the possibly-compressed name at source (active region) into target, |
727 | | * decompressing it. |
728 | | * |
729 | | * Notes: |
730 | | * \li Decompression policy is controlled by 'dctx'. |
731 | | * |
732 | | * Security: |
733 | | * |
734 | | * \li *** WARNING *** |
735 | | * |
736 | | * \li This routine will often be used when 'source' contains raw network |
737 | | * data. A programming error in this routine could result in a denial |
738 | | * of service, or in the hijacking of the server. |
739 | | * |
740 | | * Requires: |
741 | | * |
742 | | * \li 'name' is a valid name. |
743 | | * |
744 | | * \li 'source' is a valid buffer and the first byte of the active |
745 | | * region should be the first byte of a DNS wire format domain name. |
746 | | * |
747 | | * \li 'target' is a valid buffer or 'target' is NULL and 'name' has |
748 | | * a dedicated buffer. |
749 | | * |
750 | | * \li 'dctx' is a valid decompression context. |
751 | | * |
752 | | * \li DNS_NAME_DOWNCASE is not set. |
753 | | * |
754 | | * Ensures: |
755 | | * |
756 | | * If result is success: |
757 | | * \li If 'target' is not NULL, 'name' is attached to it. |
758 | | * |
759 | | * \li The current location in source is advanced, and the used space |
760 | | * in target is updated. |
761 | | * |
762 | | * Result: |
763 | | * \li Success |
764 | | * \li Bad Form: Label Length |
765 | | * \li Bad Form: Unknown Label Type |
766 | | * \li Bad Form: Name Length |
767 | | * \li Bad Form: Compression type not allowed |
768 | | * \li Bad Form: Bad compression pointer |
769 | | * \li Bad Form: Input too short |
770 | | * \li Resource Limit: Not enough space in buffer |
771 | | */ |
772 | | |
773 | | isc_result_t |
774 | | dns_name_towire(const dns_name_t *name, dns_compress_t *cctx, |
775 | | isc_buffer_t *target); |
776 | | /*%< |
777 | | * Convert 'name' into wire format, compressing it as specified by the |
778 | | * compression context 'cctx' (or leaving it uncompressed if 'cctx' is |
779 | | * NULL), and storing the result in 'target'. |
780 | | * |
781 | | * Notes: |
782 | | * \li If compression is permitted, then the cctx table may be updated. |
783 | | * |
784 | | * Requires: |
785 | | * \li 'name' is a valid name |
786 | | * |
787 | | * \li dns_name_countlabels(name) > 0 |
788 | | * |
789 | | * \li dns_name_isabsolute(name) == TRUE |
790 | | * |
791 | | * \li target is a valid buffer. |
792 | | * |
793 | | * Ensures: |
794 | | * |
795 | | * If the result is success: |
796 | | * |
797 | | * \li The used space in target is updated. |
798 | | * |
799 | | * Returns: |
800 | | * \li Success |
801 | | * \li Resource Limit: Not enough space in buffer |
802 | | */ |
803 | | |
804 | | isc_result_t |
805 | | dns_name_fromtext(dns_name_t *name, isc_buffer_t *source, |
806 | | const dns_name_t *origin, unsigned int options); |
807 | | /*%< |
808 | | * Convert the textual representation of a DNS name in 'source' |
809 | | * and store it in 'name'. |
810 | | * |
811 | | * Notes: |
812 | | * \li Relative domain names will have 'origin' appended to them |
813 | | * unless 'origin' is NULL, in which case relative domain names |
814 | | * will remain relative. |
815 | | * |
816 | | * \li If DNS_NAME_DOWNCASE is set in 'options', any uppercase letters |
817 | | * in 'source' will be downcased when they are copied into 'target'. |
818 | | * |
819 | | * Requires: |
820 | | * |
821 | | * \li 'name' is a valid name with a dedicated buffer. |
822 | | * |
823 | | * \li 'source' is a valid buffer. |
824 | | * |
825 | | * Ensures: |
826 | | * |
827 | | * If result is success: |
828 | | * \li Uppercase letters are downcased in the copy iff |
829 | | * DNS_NAME_DOWNCASE is set in 'options'. |
830 | | * |
831 | | * \li The current location in source is advanced. |
832 | | * |
833 | | * Result: |
834 | | *\li #ISC_R_SUCCESS |
835 | | *\li #DNS_R_EMPTYLABEL |
836 | | *\li #DNS_R_LABELTOOLONG |
837 | | *\li #DNS_R_BADESCAPE |
838 | | *\li #DNS_R_BADDOTTEDQUAD |
839 | | *\li #ISC_R_NOSPACE |
840 | | *\li #ISC_R_UNEXPECTEDEND |
841 | | */ |
842 | | |
843 | | isc_result_t |
844 | | dns_name_wirefromtext(isc_buffer_t *source, const dns_name_t *origin, |
845 | | unsigned int options, isc_buffer_t *target); |
846 | | /*%< |
847 | | * Convert the textual representation of a DNS name in 'source' |
848 | | * into uncompressed wire form stored in target. |
849 | | * |
850 | | * Notes: |
851 | | * \li Relative domain names will have 'origin' appended to them |
852 | | * unless 'origin' is NULL, in which case relative domain names |
853 | | * will remain relative. |
854 | | * |
855 | | * \li If DNS_NAME_DOWNCASE is set in 'options', any uppercase letters |
856 | | * in 'source' will be downcased when they are copied into 'target'. |
857 | | * |
858 | | * Requires: |
859 | | * |
860 | | * \li 'source' is a valid buffer. |
861 | | * |
862 | | * \li 'target' is a valid buffer. |
863 | | * |
864 | | * Ensures: |
865 | | * |
866 | | * If result is success: |
867 | | * \li Uppercase letters are downcased in the copy iff |
868 | | * DNS_NAME_DOWNCASE is set in 'options'. |
869 | | * |
870 | | * \li The current location in source is advanced, and the used space |
871 | | * in target is updated. |
872 | | * |
873 | | * Result: |
874 | | *\li #ISC_R_SUCCESS |
875 | | *\li #DNS_R_EMPTYLABEL |
876 | | *\li #DNS_R_LABELTOOLONG |
877 | | *\li #DNS_R_BADESCAPE |
878 | | *\li #DNS_R_BADDOTTEDQUAD |
879 | | *\li #ISC_R_NOSPACE |
880 | | *\li #ISC_R_UNEXPECTEDEND |
881 | | */ |
882 | | |
883 | 916k | #define DNS_NAME_OMITFINALDOT 0x01U |
884 | 1.02M | #define DNS_NAME_PRINCIPAL 0x02U /* do not escape $ and @ */ |
885 | | |
886 | | isc_result_t |
887 | | dns_name_totext(const dns_name_t *name, unsigned int options, |
888 | | isc_buffer_t *target); |
889 | | /*%< |
890 | | * Convert 'name' into text format, storing the result in 'target'. |
891 | | * |
892 | | * Notes: |
893 | | *\li If DNS_NAME_OMITFINALDOT is set in options, then the final '.' |
894 | | * in absolute names other than the root name will be omitted. |
895 | | * |
896 | | *\li If DNS_NAME_PRINCIPAL is set in options, '$' and '@' will *not* |
897 | | * be escaped; otherwise they will, along with other characters that |
898 | | * are special in zone files ('"', '(', ')', '.', ';', and '\'), |
899 | | * which are always escaped. |
900 | | * |
901 | | *\li If dns_name_countlabels == 0, the name will be "@", representing the |
902 | | * current origin as described by RFC1035. |
903 | | * |
904 | | *\li The name is not NUL terminated. |
905 | | * |
906 | | * Requires: |
907 | | * |
908 | | *\li 'name' is a valid name |
909 | | * |
910 | | *\li 'target' is a valid buffer |
911 | | * |
912 | | *\li if dns_name_isabsolute is false, then omit_final_dot is false |
913 | | * |
914 | | * Ensures: |
915 | | * |
916 | | *\li If the result is success: |
917 | | * the used space in target is updated. |
918 | | * |
919 | | * Returns: |
920 | | *\li #ISC_R_SUCCESS |
921 | | *\li #ISC_R_NOSPACE |
922 | | */ |
923 | | |
924 | 0 | #define DNS_NAME_MAXTEXT 1023 |
925 | | /*%< |
926 | | * The maximum length of the text representation of a domain |
927 | | * name as generated by dns_name_totext(). This does not |
928 | | * include space for a terminating NULL. |
929 | | * |
930 | | * This definition is conservative - the actual maximum |
931 | | * is 1004, derived as follows: |
932 | | * |
933 | | * A backslash-decimal escaped character takes 4 bytes. |
934 | | * A wire-encoded name can be up to 255 bytes and each |
935 | | * label is one length byte + at most 63 bytes of data. |
936 | | * Maximizing the label lengths gives us a name of |
937 | | * three 63-octet labels, one 61-octet label, and the |
938 | | * root label: |
939 | | * |
940 | | * 1 + 63 + 1 + 63 + 1 + 63 + 1 + 61 + 1 = 255 |
941 | | * |
942 | | * When printed, this is (3 * 63 + 61) * 4 |
943 | | * bytes for the escaped label data + 4 bytes for the |
944 | | * dot terminating each label = 1004 bytes total. |
945 | | */ |
946 | | |
947 | | isc_result_t |
948 | | dns_name_tofilenametext(const dns_name_t *name, bool omit_final_dot, |
949 | | isc_buffer_t *target); |
950 | | /*%< |
951 | | * Convert 'name' into an alternate text format appropriate for filenames, |
952 | | * storing the result in 'target'. The name data is downcased, guaranteeing |
953 | | * that the filename does not depend on the case of the converted name. |
954 | | * |
955 | | * Notes: |
956 | | *\li If 'omit_final_dot' is true, then the final '.' in absolute |
957 | | * names other than the root name will be omitted. |
958 | | * |
959 | | *\li The name is not NUL terminated. |
960 | | * |
961 | | * Requires: |
962 | | * |
963 | | *\li 'name' is a valid absolute name |
964 | | * |
965 | | *\li 'target' is a valid buffer. |
966 | | * |
967 | | * Ensures: |
968 | | * |
969 | | *\li If the result is success: |
970 | | * the used space in target is updated. |
971 | | * |
972 | | * Returns: |
973 | | *\li #ISC_R_SUCCESS |
974 | | *\li #ISC_R_NOSPACE |
975 | | */ |
976 | | |
977 | | isc_result_t |
978 | | dns_name_downcase(const dns_name_t *source, dns_name_t *name); |
979 | | /*%< |
980 | | * Downcase 'source'. |
981 | | * |
982 | | * Requires: |
983 | | * |
984 | | *\li 'source' and 'name' are valid names. |
985 | | * |
986 | | *\li If source == name, then |
987 | | * 'source' must not be read-only |
988 | | * |
989 | | *\li 'name' has a dedicated buffer. |
990 | | * |
991 | | * Returns: |
992 | | *\li #ISC_R_SUCCESS |
993 | | *\li #ISC_R_NOSPACE |
994 | | * |
995 | | * Note: if source == name, then the result will always be ISC_R_SUCCESS. |
996 | | */ |
997 | | |
998 | | isc_result_t |
999 | | dns_name_concatenate(const dns_name_t *prefix, const dns_name_t *suffix, |
1000 | | dns_name_t *name); |
1001 | | /*%< |
1002 | | * Concatenate 'prefix' and 'suffix' and place the result in 'name'. |
1003 | | * (Note that 'name' may be the same as 'prefix', in which case |
1004 | | * 'suffix' will be appended to it.) |
1005 | | * |
1006 | | * Requires: |
1007 | | * |
1008 | | *\li 'prefix' is a valid name or NULL. |
1009 | | * |
1010 | | *\li 'suffix' is a valid name or NULL. |
1011 | | * |
1012 | | *\li 'name' is a valid name with a dedicated buffer. |
1013 | | * |
1014 | | *\li If 'prefix' is absolute, 'suffix' must be NULL or the empty name. |
1015 | | * |
1016 | | * Returns: |
1017 | | *\li #ISC_R_SUCCESS |
1018 | | *\li #ISC_R_NOSPACE |
1019 | | *\li #DNS_R_NAMETOOLONG |
1020 | | */ |
1021 | | |
1022 | | static inline void |
1023 | | dns_name_split(const dns_name_t *name, unsigned int suffixlabels, |
1024 | 687 | dns_name_t *prefix, dns_name_t *suffix) { |
1025 | 687 | REQUIRE(DNS_NAME_VALID(name)); |
1026 | 687 | REQUIRE(suffixlabels > 0); |
1027 | 687 | REQUIRE(prefix != NULL || suffix != NULL); |
1028 | 687 | REQUIRE(prefix == NULL || |
1029 | 687 | (DNS_NAME_VALID(prefix) && DNS_NAME_BINDABLE(prefix))); |
1030 | 687 | REQUIRE(suffix == NULL || |
1031 | 687 | (DNS_NAME_VALID(suffix) && DNS_NAME_BINDABLE(suffix))); |
1032 | | |
1033 | 687 | uint8_t labels = dns_name_countlabels(name); |
1034 | 687 | INSIST(suffixlabels <= labels); |
1035 | | |
1036 | 687 | if (prefix != NULL) { |
1037 | 0 | dns_name_getlabelsequence(name, 0, labels - suffixlabels, |
1038 | 0 | prefix); |
1039 | 0 | } |
1040 | 687 | if (suffix != NULL) { |
1041 | 687 | dns_name_getlabelsequence(name, labels - suffixlabels, |
1042 | 687 | suffixlabels, suffix); |
1043 | 687 | } |
1044 | 687 | } Unexecuted instantiation: dns_qp.c:dns_name_split Unexecuted instantiation: main.c:dns_name_split Unexecuted instantiation: qp.c:dns_name_split Unexecuted instantiation: fixedname.c:dns_name_split Unexecuted instantiation: lib.c:dns_name_split Unexecuted instantiation: name.c:dns_name_split Unexecuted instantiation: qpzone.c:dns_name_split Unexecuted instantiation: rdata.c:dns_name_split Unexecuted instantiation: rdataset.c:dns_name_split Unexecuted instantiation: rdatavec.c:dns_name_split Unexecuted instantiation: zone.c:dns_name_split Unexecuted instantiation: zonefetch.c:dns_name_split Unexecuted instantiation: zonemgr.c:dns_name_split Unexecuted instantiation: zoneproperties.c:dns_name_split Unexecuted instantiation: zoneverify.c:dns_name_split Unexecuted instantiation: resolver.c:dns_name_split Unexecuted instantiation: xfrin.c:dns_name_split Unexecuted instantiation: acl.c:dns_name_split Unexecuted instantiation: adb.c:dns_name_split Unexecuted instantiation: catz.c:dns_name_split Unexecuted instantiation: compress.c:dns_name_split Unexecuted instantiation: db.c:dns_name_split Unexecuted instantiation: dbiterator.c:dns_name_split Unexecuted instantiation: diff.c:dns_name_split Unexecuted instantiation: dispatch.c:dns_name_split Unexecuted instantiation: dlz.c:dns_name_split Unexecuted instantiation: dns64.c:dns_name_split Unexecuted instantiation: dnssec.c:dns_name_split Unexecuted instantiation: ds.c:dns_name_split Unexecuted instantiation: dst_api.c:dns_name_split Unexecuted instantiation: dyndb.c:dns_name_split Unexecuted instantiation: ede.c:dns_name_split Unexecuted instantiation: forward.c:dns_name_split Unexecuted instantiation: hmac_link.c:dns_name_split Unexecuted instantiation: ipkeylist.c:dns_name_split Unexecuted instantiation: iptable.c:dns_name_split Unexecuted instantiation: journal.c:dns_name_split Unexecuted instantiation: kasp.c:dns_name_split Unexecuted instantiation: key.c:dns_name_split Unexecuted instantiation: keydata.c:dns_name_split Unexecuted instantiation: keymgr.c:dns_name_split Unexecuted instantiation: keystore.c:dns_name_split Unexecuted instantiation: keytable.c:dns_name_split Unexecuted instantiation: master.c:dns_name_split Unexecuted instantiation: masterdump.c:dns_name_split Line | Count | Source | 1024 | 687 | dns_name_t *prefix, dns_name_t *suffix) { | 1025 | 687 | REQUIRE(DNS_NAME_VALID(name)); | 1026 | 687 | REQUIRE(suffixlabels > 0); | 1027 | 687 | REQUIRE(prefix != NULL || suffix != NULL); | 1028 | 687 | REQUIRE(prefix == NULL || | 1029 | 687 | (DNS_NAME_VALID(prefix) && DNS_NAME_BINDABLE(prefix))); | 1030 | 687 | REQUIRE(suffix == NULL || | 1031 | 687 | (DNS_NAME_VALID(suffix) && DNS_NAME_BINDABLE(suffix))); | 1032 | | | 1033 | 687 | uint8_t labels = dns_name_countlabels(name); | 1034 | 687 | INSIST(suffixlabels <= labels); | 1035 | | | 1036 | 687 | if (prefix != NULL) { | 1037 | 0 | dns_name_getlabelsequence(name, 0, labels - suffixlabels, | 1038 | 0 | prefix); | 1039 | 0 | } | 1040 | 687 | if (suffix != NULL) { | 1041 | 687 | dns_name_getlabelsequence(name, labels - suffixlabels, | 1042 | 687 | suffixlabels, suffix); | 1043 | 687 | } | 1044 | 687 | } |
Unexecuted instantiation: nametree.c:dns_name_split Unexecuted instantiation: ncache.c:dns_name_split Unexecuted instantiation: notify.c:dns_name_split Unexecuted instantiation: nsec.c:dns_name_split Unexecuted instantiation: nsec3.c:dns_name_split Unexecuted instantiation: opensslecdsa_link.c:dns_name_split Unexecuted instantiation: openssleddsa_link.c:dns_name_split Unexecuted instantiation: opensslrsa_link.c:dns_name_split Unexecuted instantiation: peer.c:dns_name_split Unexecuted instantiation: private.c:dns_name_split Unexecuted instantiation: qpcache.c:dns_name_split Unexecuted instantiation: rcode.c:dns_name_split Unexecuted instantiation: rdatalist.c:dns_name_split Unexecuted instantiation: rdatasetiter.c:dns_name_split Unexecuted instantiation: rdataslab.c:dns_name_split Unexecuted instantiation: remote.c:dns_name_split Unexecuted instantiation: request.c:dns_name_split Unexecuted instantiation: rpz.c:dns_name_split Unexecuted instantiation: rriterator.c:dns_name_split Unexecuted instantiation: skr.c:dns_name_split Unexecuted instantiation: soa.c:dns_name_split Unexecuted instantiation: ssu.c:dns_name_split Unexecuted instantiation: ssu_external.c:dns_name_split Unexecuted instantiation: stats.c:dns_name_split Unexecuted instantiation: transport.c:dns_name_split Unexecuted instantiation: tsig.c:dns_name_split Unexecuted instantiation: unreachcache.c:dns_name_split Unexecuted instantiation: update.c:dns_name_split Unexecuted instantiation: validator.c:dns_name_split Unexecuted instantiation: view.c:dns_name_split Unexecuted instantiation: zt.c:dns_name_split Unexecuted instantiation: deleg.c:dns_name_split Unexecuted instantiation: badcache.c:dns_name_split Unexecuted instantiation: cache.c:dns_name_split Unexecuted instantiation: dst_parse.c:dns_name_split Unexecuted instantiation: gssapictx.c:dns_name_split Unexecuted instantiation: nta.c:dns_name_split Unexecuted instantiation: openssl_link.c:dns_name_split Unexecuted instantiation: order.c:dns_name_split Unexecuted instantiation: rrl.c:dns_name_split Unexecuted instantiation: dns_rdata_fromtext.c:dns_name_split Unexecuted instantiation: dns_qpkey_name.c:dns_name_split Unexecuted instantiation: dns_master_load.c:dns_name_split Unexecuted instantiation: dns_rdata_fromwire_text.c:dns_name_split Unexecuted instantiation: dns_name_fromwire.c:dns_name_split Unexecuted instantiation: old.c:dns_name_split Unexecuted instantiation: isc_lex_getmastertoken.c:dns_name_split Unexecuted instantiation: isc_lex_gettoken.c:dns_name_split Unexecuted instantiation: dns_message_checksig.c:dns_name_split Unexecuted instantiation: dns_name_fromtext_target.c:dns_name_split Unexecuted instantiation: dns_message_parse.c:dns_name_split |
1045 | | /*%< |
1046 | | * |
1047 | | * Split 'name' into two pieces on a label boundary. |
1048 | | * |
1049 | | * Notes: |
1050 | | * \li 'name' is split such that 'suffix' holds the most significant |
1051 | | * 'suffixlabels' labels. All other labels are stored in 'prefix'. |
1052 | | * |
1053 | | *\li Copying name data is avoided as much as possible, so 'prefix' |
1054 | | * and 'suffix' will end up pointing at the data for 'name'. |
1055 | | * |
1056 | | *\li It is legitimate to pass a 'prefix' or 'suffix' that has |
1057 | | * its name data stored someplace other than the dedicated buffer. |
1058 | | * This is useful to avoid name copying in the calling function. |
1059 | | * |
1060 | | *\li It is also legitimate to pass a 'prefix' or 'suffix' that is |
1061 | | * the same dns_name_t as 'name'. |
1062 | | * |
1063 | | * Requires: |
1064 | | *\li 'name' is a valid name. |
1065 | | * |
1066 | | *\li 'suffixlabels' cannot exceed the number of labels in 'name'. |
1067 | | * |
1068 | | * \li 'prefix' is a valid name or NULL, and cannot be read-only. |
1069 | | * |
1070 | | *\li 'suffix' is a valid name or NULL, and cannot be read-only. |
1071 | | * |
1072 | | * Ensures: |
1073 | | * |
1074 | | *\li On success: |
1075 | | * If 'prefix' is not NULL it will contain the least significant |
1076 | | * labels. |
1077 | | * If 'suffix' is not NULL it will contain the most significant |
1078 | | * labels. dns_name_countlabels(suffix) will be equal to |
1079 | | * suffixlabels. |
1080 | | * |
1081 | | *\li On failure: |
1082 | | * Either 'prefix' or 'suffix' is invalidated (depending |
1083 | | * on which one the problem was encountered with). |
1084 | | * |
1085 | | * Returns: |
1086 | | *\li #ISC_R_SUCCESS No worries. (This function should always success). |
1087 | | */ |
1088 | | |
1089 | | void |
1090 | | dns_name_dup(const dns_name_t *source, isc_mem_t *mctx, dns_name_t *target); |
1091 | | /*%< |
1092 | | * Make 'target' a dynamically allocated copy of 'source'. |
1093 | | * |
1094 | | * Requires: |
1095 | | * |
1096 | | *\li 'source' is a valid non-empty name. |
1097 | | * |
1098 | | *\li 'target' is a valid name that is not read-only. |
1099 | | * |
1100 | | *\li 'mctx' is a valid memory context. |
1101 | | */ |
1102 | | |
1103 | | void |
1104 | | dns_name_free(dns_name_t *name, isc_mem_t *mctx); |
1105 | | /*%< |
1106 | | * Free 'name'. |
1107 | | * |
1108 | | * Requires: |
1109 | | * |
1110 | | *\li 'name' is a valid name created previously in 'mctx' by dns_name_dup(). |
1111 | | * |
1112 | | *\li 'mctx' is a valid memory context. |
1113 | | * |
1114 | | * Ensures: |
1115 | | * |
1116 | | *\li All dynamic resources used by 'name' are freed and the name is |
1117 | | * invalidated. |
1118 | | */ |
1119 | | |
1120 | | isc_result_t |
1121 | | dns_name_digest(const dns_name_t *name, dns_digestfunc_t digest, void *arg); |
1122 | | /*%< |
1123 | | * Send 'name' in DNSSEC canonical form to 'digest'. |
1124 | | * |
1125 | | * Requires: |
1126 | | * |
1127 | | *\li 'name' is a valid name. |
1128 | | * |
1129 | | *\li 'digest' is a valid dns_digestfunc_t. |
1130 | | * |
1131 | | * Ensures: |
1132 | | * |
1133 | | *\li If successful, the DNSSEC canonical form of 'name' will have been |
1134 | | * sent to 'digest'. |
1135 | | * |
1136 | | *\li If digest() returns something other than ISC_R_SUCCESS, that result |
1137 | | * will be returned as the result of dns_name_digest(). |
1138 | | * |
1139 | | * Returns: |
1140 | | * |
1141 | | *\li #ISC_R_SUCCESS |
1142 | | * |
1143 | | *\li Many other results are possible if not successful. |
1144 | | * |
1145 | | */ |
1146 | | |
1147 | | bool |
1148 | | dns_name_dynamic(const dns_name_t *name); |
1149 | | /*%< |
1150 | | * Returns whether there is dynamic memory associated with this name. |
1151 | | * |
1152 | | * Requires: |
1153 | | * |
1154 | | *\li 'name' is a valid name. |
1155 | | * |
1156 | | * Returns: |
1157 | | * |
1158 | | *\li 'true' if the name is dynamic otherwise 'false'. |
1159 | | */ |
1160 | | |
1161 | | isc_result_t |
1162 | | dns_name_print(const dns_name_t *name, FILE *stream); |
1163 | | /*%< |
1164 | | * Print 'name' on 'stream'. |
1165 | | * |
1166 | | * Requires: |
1167 | | * |
1168 | | *\li 'name' is a valid name. |
1169 | | * |
1170 | | *\li 'stream' is a valid stream. |
1171 | | * |
1172 | | * Returns: |
1173 | | * |
1174 | | *\li #ISC_R_SUCCESS |
1175 | | * |
1176 | | *\li Any error that dns_name_totext() can return. |
1177 | | */ |
1178 | | |
1179 | | void |
1180 | | dns_name_format(const dns_name_t *name, char *cp, unsigned int size); |
1181 | | /*%< |
1182 | | * Format 'name' as text appropriate for use in log messages. |
1183 | | * |
1184 | | * Store the formatted name at 'cp', writing no more than |
1185 | | * 'size' bytes. The resulting string is guaranteed to be |
1186 | | * null terminated. |
1187 | | * |
1188 | | * The formatted name will have a terminating dot only if it is |
1189 | | * the root. |
1190 | | * |
1191 | | * This function cannot fail, instead any errors are indicated |
1192 | | * in the returned text. |
1193 | | * |
1194 | | * Requires: |
1195 | | * |
1196 | | *\li 'name' is a valid name. |
1197 | | * |
1198 | | *\li 'cp' points a valid character array of size 'size'. |
1199 | | * |
1200 | | *\li 'size' > 0. |
1201 | | * |
1202 | | */ |
1203 | | |
1204 | | isc_result_t |
1205 | | dns_name_tostring(const dns_name_t *source, char **target, isc_mem_t *mctx); |
1206 | | /*%< |
1207 | | * Convert 'name' to string format, allocating sufficient memory to |
1208 | | * hold it (free with isc_mem_free()). |
1209 | | * |
1210 | | * Differs from dns_name_format in that it allocates its own memory. |
1211 | | * |
1212 | | * Requires: |
1213 | | * |
1214 | | *\li 'name' is a valid name. |
1215 | | *\li 'target' is not NULL. |
1216 | | *\li '*target' is NULL. |
1217 | | * |
1218 | | * Returns: |
1219 | | * |
1220 | | *\li ISC_R_SUCCESS |
1221 | | *\li Any error that dns_name_totext() can return. |
1222 | | */ |
1223 | | |
1224 | | isc_result_t |
1225 | | dns_name_fromstring(dns_name_t *target, const char *src, |
1226 | | const dns_name_t *origin, unsigned int options, |
1227 | | isc_mem_t *mctx); |
1228 | | /*%< |
1229 | | * Convert a string to a name and place it in target, allocating memory |
1230 | | * as necessary. 'options' has the same semantics as that of |
1231 | | * dns_name_fromtext(). |
1232 | | * |
1233 | | * If 'target' has a buffer then the name will be copied into it rather than |
1234 | | * memory being allocated. |
1235 | | * |
1236 | | * Requires: |
1237 | | * |
1238 | | * \li 'target' is a valid name that is not read-only. |
1239 | | * \li 'src' is not NULL. |
1240 | | * |
1241 | | * Returns: |
1242 | | * |
1243 | | *\li #ISC_R_SUCCESS |
1244 | | * |
1245 | | *\li Any error that dns_name_fromtext() can return. |
1246 | | * |
1247 | | *\li Any error that dns_name_dup() can return. |
1248 | | */ |
1249 | | |
1250 | | isc_result_t |
1251 | | dns_name_settotextfilter(dns_name_totextfilter_t *proc); |
1252 | | /*%< |
1253 | | * Set / clear a thread specific function 'proc' to be called at the |
1254 | | * end of dns_name_totext(). |
1255 | | * |
1256 | | * Note: It's a good practice to call "dns_name_settotextfilter(NULL);" |
1257 | | * prior to exiting the thread. |
1258 | | * |
1259 | | * Returns |
1260 | | *\li #ISC_R_SUCCESS |
1261 | | *\li #ISC_R_UNEXPECTED |
1262 | | */ |
1263 | | |
1264 | 0 | #define DNS_NAME_FORMATSIZE (DNS_NAME_MAXTEXT + 1) |
1265 | | /*%< |
1266 | | * Suggested size of buffer passed to dns_name_format(). |
1267 | | * Includes space for the terminating NULL. |
1268 | | */ |
1269 | | |
1270 | | void |
1271 | | dns_name_copy(const dns_name_t *source, dns_name_t *dest); |
1272 | | /*%< |
1273 | | * Copies the name in 'source' into 'dest'. The name data is copied to |
1274 | | * the dedicated buffer for 'dest'. (If copying to a name that doesn't |
1275 | | * have a dedicated buffer, use dns_name_setbuffer() first.) |
1276 | | * |
1277 | | * Requires: |
1278 | | * \li 'source' is a valid name. |
1279 | | * |
1280 | | * \li 'dest' is an initialized name with a dedicated buffer. |
1281 | | */ |
1282 | | |
1283 | | bool |
1284 | | dns_name_ishostname(const dns_name_t *name, bool wildcard); |
1285 | | /*%< |
1286 | | * Return if 'name' is a valid hostname. RFC 952 / RFC 1123. |
1287 | | * If 'wildcard' is true then allow the first label of name to |
1288 | | * be a wildcard. |
1289 | | * The root is also accepted. |
1290 | | * |
1291 | | * Requires: |
1292 | | * 'name' to be valid. |
1293 | | */ |
1294 | | |
1295 | | bool |
1296 | | dns_name_ismailbox(const dns_name_t *name); |
1297 | | /*%< |
1298 | | * Return if 'name' is a valid mailbox. RFC 821. |
1299 | | * |
1300 | | * Requires: |
1301 | | * \li 'name' to be valid. |
1302 | | */ |
1303 | | |
1304 | | bool |
1305 | | dns_name_internalwildcard(const dns_name_t *name); |
1306 | | /*%< |
1307 | | * Return if 'name' contains a internal wildcard name. |
1308 | | * |
1309 | | * Requires: |
1310 | | * \li 'name' to be valid. |
1311 | | */ |
1312 | | |
1313 | | bool |
1314 | | dns_name_isdnssd(const dns_name_t *owner); |
1315 | | /*%< |
1316 | | * Determine if the 'owner' is a DNS-SD prefix. |
1317 | | */ |
1318 | | |
1319 | | bool |
1320 | | dns_name_isrfc1918(const dns_name_t *owner); |
1321 | | /*%< |
1322 | | * Determine if the 'name' is in the RFC 1918 reverse namespace. |
1323 | | */ |
1324 | | |
1325 | | bool |
1326 | | dns_name_isula(const dns_name_t *owner); |
1327 | | /*%< |
1328 | | * Determine if the 'name' is in the ULA reverse namespace. |
1329 | | */ |
1330 | | |
1331 | | bool |
1332 | | dns_name_istat(const dns_name_t *name); |
1333 | | /*%< |
1334 | | * Determine if 'name' is a potential 'trust-anchor-telemetry' name. |
1335 | | */ |
1336 | | |
1337 | | bool |
1338 | | dns_name_isdnssvcb(const dns_name_t *name); |
1339 | | /*%< |
1340 | | * Determine if 'name' is a dns service name, |
1341 | | * i.e. it starts with and optional _port label followed by a _dns label. |
1342 | | */ |
1343 | | |
1344 | | size_t |
1345 | | dns_name_size(const dns_name_t *name); |
1346 | | /*%< |
1347 | | * Return the amount of dynamically allocated memory associated with |
1348 | | * 'name' (which is 0 if 'name' is not dynamic). |
1349 | | */ |
1350 | | |
1351 | | bool |
1352 | | dns_name_israd(const dns_name_t *name, const dns_name_t *rad); |
1353 | | /*%< |
1354 | | * Determine whether 'name' matches the prescribed format of a |
1355 | | * DNS error-reporting name: |
1356 | | * |
1357 | | * _er.<TYPE>.<QNAME>.<EDE>._er.<AGENT-DOMAIN>. |
1358 | | * |
1359 | | * AGENT-DOMAIN is specified by the 'rad' parameter. |
1360 | | * EDE is a numeric value representing an extended DNS error code. |
1361 | | * TYPE and EDE are not currently checked. |
1362 | | * |
1363 | | * Requires: |
1364 | | * \li 'name' to be valid. |
1365 | | */ |