xref: /freebsd/contrib/unbound/sldns/rrdef.h (revision be771a7b7f4580a30d99e41a5bb1b93a385a119d)
1 /*
2  * rrdef.h
3  *
4  * RR definitions
5  *
6  * a Net::DNS like library for C
7  *
8  * (c) NLnet Labs, 2005-2006
9  *
10  * See the file LICENSE for the license
11  */
12 
13 /**
14  * \file
15  *
16  * Defines resource record types and constants.
17  */
18 
19 #ifndef LDNS_RRDEF_H
20 #define LDNS_RRDEF_H
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 /** Maximum length of a dname label */
27 #define LDNS_MAX_LABELLEN     63
28 /** Maximum length of a complete dname */
29 #define LDNS_MAX_DOMAINLEN    255
30 /** Maximum number of pointers in 1 dname */
31 #define LDNS_MAX_POINTERS	65535
32 /** The bytes TTL, CLASS and length use up in an rr */
33 #define LDNS_RR_OVERHEAD	10
34 
35 #define LDNS_DNSSEC_KEYPROTO    3
36 #define LDNS_KEY_ZONE_KEY   0x0100 /* set for ZSK&KSK, rfc 4034 */
37 #define LDNS_KEY_SEP_KEY    0x0001 /* set for KSK, rfc 4034 */
38 #define LDNS_KEY_REVOKE_KEY 0x0080 /* used to revoke KSK, rfc 5011 */
39 
40 /* The first fields are contiguous and can be referenced instantly */
41 #define LDNS_RDATA_FIELD_DESCRIPTORS_COMMON 259
42 
43 /** lookuptable for rr classes  */
44 extern struct sldns_struct_lookup_table* sldns_rr_classes;
45 
46 /**
47  *  The different RR classes.
48  */
49 enum sldns_enum_rr_class
50 {
51 	/** the Internet */
52 	LDNS_RR_CLASS_IN 	= 1,
53 	/** Chaos class */
54 	LDNS_RR_CLASS_CH	= 3,
55 	/** Hesiod (Dyer 87) */
56 	LDNS_RR_CLASS_HS	= 4,
57 	/** None class, dynamic update */
58 	LDNS_RR_CLASS_NONE      = 254,
59 	/** Any class */
60 	LDNS_RR_CLASS_ANY	= 255,
61 
62 	LDNS_RR_CLASS_FIRST     = 0,
63 	LDNS_RR_CLASS_LAST      = 65535,
64 	LDNS_RR_CLASS_COUNT     = LDNS_RR_CLASS_LAST - LDNS_RR_CLASS_FIRST + 1
65 };
66 typedef enum sldns_enum_rr_class sldns_rr_class;
67 
68 /**
69  *  Used to specify whether compression is allowed.
70  */
71 enum sldns_enum_rr_compress
72 {
73 	/** compression is allowed */
74 	LDNS_RR_COMPRESS,
75 	LDNS_RR_NO_COMPRESS
76 };
77 typedef enum sldns_enum_rr_compress sldns_rr_compress;
78 
79 /**
80  * The different RR types.
81  */
82 enum sldns_enum_rr_type
83 {
84 	/**  a host address */
85 	LDNS_RR_TYPE_A = 1,
86 	/**  an authoritative name server */
87 	LDNS_RR_TYPE_NS = 2,
88 	/**  a mail destination (Obsolete - use MX) */
89 	LDNS_RR_TYPE_MD = 3,
90 	/**  a mail forwarder (Obsolete - use MX) */
91 	LDNS_RR_TYPE_MF = 4,
92 	/**  the canonical name for an alias */
93 	LDNS_RR_TYPE_CNAME = 5,
94 	/**  marks the start of a zone of authority */
95 	LDNS_RR_TYPE_SOA = 6,
96 	/**  a mailbox domain name (EXPERIMENTAL) */
97 	LDNS_RR_TYPE_MB = 7,
98 	/**  a mail group member (EXPERIMENTAL) */
99 	LDNS_RR_TYPE_MG = 8,
100 	/**  a mail rename domain name (EXPERIMENTAL) */
101 	LDNS_RR_TYPE_MR = 9,
102 	/**  a null RR (EXPERIMENTAL) */
103 	LDNS_RR_TYPE_NULL = 10,
104 	/**  a well known service description */
105 	LDNS_RR_TYPE_WKS = 11,
106 	/**  a domain name pointer */
107 	LDNS_RR_TYPE_PTR = 12,
108 	/**  host information */
109 	LDNS_RR_TYPE_HINFO = 13,
110 	/**  mailbox or mail list information */
111 	LDNS_RR_TYPE_MINFO = 14,
112 	/**  mail exchange */
113 	LDNS_RR_TYPE_MX = 15,
114 	/**  text strings */
115 	LDNS_RR_TYPE_TXT = 16,
116 	/**  RFC1183 */
117 	LDNS_RR_TYPE_RP = 17,
118 	/**  RFC1183 */
119 	LDNS_RR_TYPE_AFSDB = 18,
120 	/**  RFC1183 */
121 	LDNS_RR_TYPE_X25 = 19,
122 	/**  RFC1183 */
123 	LDNS_RR_TYPE_ISDN = 20,
124 	/**  RFC1183 */
125 	LDNS_RR_TYPE_RT = 21,
126 	/**  RFC1706 */
127 	LDNS_RR_TYPE_NSAP = 22,
128 	/**  RFC1348 */
129 	LDNS_RR_TYPE_NSAP_PTR = 23,
130 	/**  2535typecode */
131 	LDNS_RR_TYPE_SIG = 24,
132 	/**  2535typecode */
133 	LDNS_RR_TYPE_KEY = 25,
134 	/**  RFC2163 */
135 	LDNS_RR_TYPE_PX = 26,
136 	/**  RFC1712 */
137 	LDNS_RR_TYPE_GPOS = 27,
138 	/**  ipv6 address */
139 	LDNS_RR_TYPE_AAAA = 28,
140 	/**  LOC record  RFC1876 */
141 	LDNS_RR_TYPE_LOC = 29,
142 	/**  2535typecode */
143 	LDNS_RR_TYPE_NXT = 30,
144 	/**  draft-ietf-nimrod-dns-01.txt */
145 	LDNS_RR_TYPE_EID = 31,
146 	/**  draft-ietf-nimrod-dns-01.txt */
147 	LDNS_RR_TYPE_NIMLOC = 32,
148 	/**  SRV record RFC2782 */
149 	LDNS_RR_TYPE_SRV = 33,
150 	/**  http://www.jhsoft.com/rfc/af-saa-0069.000.rtf */
151 	LDNS_RR_TYPE_ATMA = 34,
152 	/**  RFC2915 */
153 	LDNS_RR_TYPE_NAPTR = 35,
154 	/**  RFC2230 */
155 	LDNS_RR_TYPE_KX = 36,
156 	/**  RFC2538 */
157 	LDNS_RR_TYPE_CERT = 37,
158 	/**  RFC2874 */
159 	LDNS_RR_TYPE_A6 = 38,
160 	/**  RFC2672 */
161 	LDNS_RR_TYPE_DNAME = 39,
162 	/**  dnsind-kitchen-sink-02.txt */
163 	LDNS_RR_TYPE_SINK = 40,
164 	/**  Pseudo OPT record... */
165 	LDNS_RR_TYPE_OPT = 41,
166 	/**  RFC3123 */
167 	LDNS_RR_TYPE_APL = 42,
168 	/**  RFC4034, RFC3658 */
169 	LDNS_RR_TYPE_DS = 43,
170 	/**  SSH Key Fingerprint */
171 	LDNS_RR_TYPE_SSHFP = 44, /* RFC 4255 */
172 	/**  IPsec Key */
173 	LDNS_RR_TYPE_IPSECKEY = 45, /* RFC 4025 */
174 	/**  DNSSEC */
175 	LDNS_RR_TYPE_RRSIG = 46, /* RFC 4034 */
176 	LDNS_RR_TYPE_NSEC = 47, /* RFC 4034 */
177 	LDNS_RR_TYPE_DNSKEY = 48, /* RFC 4034 */
178 
179 	LDNS_RR_TYPE_DHCID = 49, /* RFC 4701 */
180 	/* NSEC3 */
181 	LDNS_RR_TYPE_NSEC3 = 50, /* RFC 5155 */
182 	LDNS_RR_TYPE_NSEC3PARAM = 51, /* RFC 5155 */
183 	LDNS_RR_TYPE_NSEC3PARAMS = 51,
184 	LDNS_RR_TYPE_TLSA = 52, /* RFC 6698 */
185 	LDNS_RR_TYPE_SMIMEA = 53, /* RFC 8162 */
186 	LDNS_RR_TYPE_HIP = 55, /* RFC 5205 */
187 
188 	/** draft-reid-dnsext-zs */
189 	LDNS_RR_TYPE_NINFO = 56,
190 	/** draft-reid-dnsext-rkey */
191 	LDNS_RR_TYPE_RKEY = 57,
192         /** draft-ietf-dnsop-trust-history */
193         LDNS_RR_TYPE_TALINK = 58,
194 	LDNS_RR_TYPE_CDS = 59, /** RFC 7344 */
195 	LDNS_RR_TYPE_CDNSKEY = 60, /** RFC 7344 */
196 	LDNS_RR_TYPE_OPENPGPKEY = 61, /* RFC 7929 */
197 	LDNS_RR_TYPE_CSYNC = 62, /* RFC 7477 */
198 	LDNS_RR_TYPE_ZONEMD = 63, /* draft-ietf-dnsop-dns-zone-digest-12 */
199 	LDNS_RR_TYPE_SVCB = 64, /* draft-ietf-dnsop-svcb-https-04 */
200 	LDNS_RR_TYPE_HTTPS = 65, /* draft-ietf-dnsop-svcb-https-04 */
201 
202 	LDNS_RR_TYPE_SPF = 99, /* RFC 4408 */
203 
204 	LDNS_RR_TYPE_UINFO = 100,
205 	LDNS_RR_TYPE_UID = 101,
206 	LDNS_RR_TYPE_GID = 102,
207 	LDNS_RR_TYPE_UNSPEC = 103,
208 
209 	LDNS_RR_TYPE_NID = 104, /* RFC 6742 */
210 	LDNS_RR_TYPE_L32 = 105, /* RFC 6742 */
211 	LDNS_RR_TYPE_L64 = 106, /* RFC 6742 */
212 	LDNS_RR_TYPE_LP = 107, /* RFC 6742 */
213 
214 	/** draft-jabley-dnsext-eui48-eui64-rrtypes */
215 	LDNS_RR_TYPE_EUI48 = 108,
216 	LDNS_RR_TYPE_EUI64 = 109,
217 
218 	LDNS_RR_TYPE_TKEY = 249, /* RFC 2930 */
219 	LDNS_RR_TYPE_TSIG = 250,
220 	LDNS_RR_TYPE_IXFR = 251,
221 	LDNS_RR_TYPE_AXFR = 252,
222 	/**  A request for mailbox-related records (MB, MG or MR) */
223 	LDNS_RR_TYPE_MAILB = 253,
224 	/**  A request for mail agent RRs (Obsolete - see MX) */
225 	LDNS_RR_TYPE_MAILA = 254,
226 	/**  any type (wildcard) */
227 	LDNS_RR_TYPE_ANY = 255,
228 	LDNS_RR_TYPE_URI = 256, /* RFC 7553 */
229 	LDNS_RR_TYPE_CAA = 257, /* RFC 6844 */
230 	LDNS_RR_TYPE_AVC = 258,
231 
232 	LDNS_RR_TYPE_RESINFO = 261, /* RFC 9606 */
233 
234 	/** DNSSEC Trust Authorities */
235 	LDNS_RR_TYPE_TA = 32768,
236 	/* RFC 4431, 5074, DNSSEC Lookaside Validation */
237 	LDNS_RR_TYPE_DLV = 32769,
238 
239 	/* type codes from nsec3 experimental phase
240 	LDNS_RR_TYPE_NSEC3 = 65324,
241 	LDNS_RR_TYPE_NSEC3PARAMS = 65325, */
242 	LDNS_RR_TYPE_FIRST = 0,
243 	LDNS_RR_TYPE_LAST  = 65535,
244 	LDNS_RR_TYPE_COUNT = LDNS_RR_TYPE_LAST - LDNS_RR_TYPE_FIRST + 1
245 };
246 typedef enum sldns_enum_rr_type sldns_rr_type;
247 
248 /* RDATA */
249 #define LDNS_MAX_RDFLEN	65535
250 
251 #define LDNS_RDF_SIZE_BYTE              1
252 #define LDNS_RDF_SIZE_WORD              2
253 #define LDNS_RDF_SIZE_DOUBLEWORD        4
254 #define LDNS_RDF_SIZE_6BYTES            6
255 #define LDNS_RDF_SIZE_8BYTES            8
256 #define LDNS_RDF_SIZE_16BYTES           16
257 
258 #define LDNS_NSEC3_VARS_OPTOUT_MASK 0x01
259 
260 #define LDNS_APL_IP4            1
261 #define LDNS_APL_IP6            2
262 #define LDNS_APL_MASK           0x7f
263 #define LDNS_APL_NEGATION       0x80
264 
265 /**
266  * The different types of RDATA fields.
267  */
268 enum sldns_enum_rdf_type
269 {
270 	/** none */
271 	LDNS_RDF_TYPE_NONE,
272 	/** domain name */
273 	LDNS_RDF_TYPE_DNAME,
274 	/** 8 bits */
275 	LDNS_RDF_TYPE_INT8,
276 	/** 16 bits */
277 	LDNS_RDF_TYPE_INT16,
278 	/** 32 bits */
279 	LDNS_RDF_TYPE_INT32,
280 	/** A record */
281 	LDNS_RDF_TYPE_A,
282 	/** AAAA record */
283 	LDNS_RDF_TYPE_AAAA,
284 	/** txt string */
285 	LDNS_RDF_TYPE_STR,
286 	/** apl data */
287 	LDNS_RDF_TYPE_APL,
288 	/** b32 string */
289 	LDNS_RDF_TYPE_B32_EXT,
290 	/** b64 string */
291 	LDNS_RDF_TYPE_B64,
292 	/** hex string */
293 	LDNS_RDF_TYPE_HEX,
294 	/** nsec type codes */
295 	LDNS_RDF_TYPE_NSEC,
296 	/** a RR type */
297 	LDNS_RDF_TYPE_TYPE,
298 	/** a class */
299 	LDNS_RDF_TYPE_CLASS,
300 	/** certificate algorithm */
301 	LDNS_RDF_TYPE_CERT_ALG,
302 	/** a key algorithm */
303         LDNS_RDF_TYPE_ALG,
304         /** unknown types */
305         LDNS_RDF_TYPE_UNKNOWN,
306         /** time (32 bits) */
307         LDNS_RDF_TYPE_TIME,
308         /** period */
309         LDNS_RDF_TYPE_PERIOD,
310         /** tsig time 48 bits */
311         LDNS_RDF_TYPE_TSIGTIME,
312 	/** Represents the Public Key Algorithm, HIT and Public Key fields
313 	    for the HIP RR types.  A HIP specific rdf type is used because of
314 	    the unusual layout in wireformat (see RFC 5205 Section 5) */
315 	LDNS_RDF_TYPE_HIP,
316         /** variable length any type rdata where the length
317             is specified by the first 2 bytes */
318         LDNS_RDF_TYPE_INT16_DATA,
319         /** protocol and port bitmaps */
320         LDNS_RDF_TYPE_SERVICE,
321         /** location data */
322         LDNS_RDF_TYPE_LOC,
323         /** well known services */
324         LDNS_RDF_TYPE_WKS,
325         /** NSAP */
326         LDNS_RDF_TYPE_NSAP,
327         /** ATMA */
328         LDNS_RDF_TYPE_ATMA,
329         /** IPSECKEY */
330         LDNS_RDF_TYPE_IPSECKEY,
331         /** nsec3 hash salt */
332         LDNS_RDF_TYPE_NSEC3_SALT,
333         /** nsec3 base32 string (with length byte on wire */
334         LDNS_RDF_TYPE_NSEC3_NEXT_OWNER,
335 
336         /** 4 shorts represented as 4 * 16 bit hex numbers
337          *  separated by colons. For NID and L64.
338          */
339         LDNS_RDF_TYPE_ILNP64,
340 
341         /** 6 * 8 bit hex numbers separated by dashes. For EUI48. */
342         LDNS_RDF_TYPE_EUI48,
343         /** 8 * 8 bit hex numbers separated by dashes. For EUI64. */
344         LDNS_RDF_TYPE_EUI64,
345 
346 	/** Character string without quotes. */
347 	LDNS_RDF_TYPE_UNQUOTED,
348 
349         /** A non-zero sequence of US-ASCII letters and numbers in lower case.
350          *  For CAA.
351          */
352         LDNS_RDF_TYPE_TAG,
353 
354         /** A <character-string> encoding of the value field as specified
355          * [RFC1035], Section 5.1., encoded as remaining rdata.
356          * For CAA, URI.
357          */
358         LDNS_RDF_TYPE_LONG_STR,
359 
360 	/** TSIG extended 16bit error value */
361 	LDNS_RDF_TYPE_TSIGERROR,
362 
363 	/* draft-ietf-dnsop-svcb-https-05:
364 	 * each SvcParam consisting of a SvcParamKey=SvcParamValue pair or
365 	 * a standalone SvcParamKey */
366 	LDNS_RDF_TYPE_SVCPARAM,
367 
368         /* Aliases */
369         LDNS_RDF_TYPE_BITMAP = LDNS_RDF_TYPE_NSEC,
370 };
371 typedef enum sldns_enum_rdf_type sldns_rdf_type;
372 
373 /**
374  * Algorithms used in dns
375  */
376 enum sldns_enum_algorithm
377 {
378         LDNS_RSAMD5             = 1,   /* RFC 4034,4035 */
379         LDNS_DH                 = 2,
380         LDNS_DSA                = 3,
381         LDNS_ECC                = 4,
382         LDNS_RSASHA1            = 5,
383         LDNS_DSA_NSEC3          = 6,
384         LDNS_RSASHA1_NSEC3      = 7,
385         LDNS_RSASHA256          = 8,   /* RFC 5702 */
386         LDNS_RSASHA512          = 10,  /* RFC 5702 */
387         LDNS_ECC_GOST           = 12,  /* RFC 5933 */
388         LDNS_ECDSAP256SHA256    = 13,  /* RFC 6605 */
389         LDNS_ECDSAP384SHA384    = 14,  /* RFC 6605 */
390 	LDNS_ED25519		= 15,  /* RFC 8080 */
391 	LDNS_ED448		= 16,  /* RFC 8080 */
392         LDNS_INDIRECT           = 252,
393         LDNS_PRIVATEDNS         = 253,
394         LDNS_PRIVATEOID         = 254
395 };
396 typedef enum sldns_enum_algorithm sldns_algorithm;
397 
398 /**
399  * Hashing algorithms used in the DS record
400  */
401 enum sldns_enum_hash
402 {
403         LDNS_SHA1               = 1,  /* RFC 4034 */
404         LDNS_SHA256             = 2,  /* RFC 4509 */
405         LDNS_HASH_GOST          = 3,  /* RFC 5933 */
406         LDNS_SHA384             = 4   /* RFC 6605 */
407 };
408 typedef enum sldns_enum_hash sldns_hash;
409 
410 /**
411  * algorithms used in CERT rrs
412  */
413 enum sldns_enum_cert_algorithm
414 {
415         LDNS_CERT_PKIX          = 1,
416         LDNS_CERT_SPKI          = 2,
417         LDNS_CERT_PGP           = 3,
418         LDNS_CERT_IPKIX         = 4,
419         LDNS_CERT_ISPKI         = 5,
420         LDNS_CERT_IPGP          = 6,
421         LDNS_CERT_ACPKIX        = 7,
422         LDNS_CERT_IACPKIX       = 8,
423         LDNS_CERT_URI           = 253,
424         LDNS_CERT_OID           = 254
425 };
426 typedef enum sldns_enum_cert_algorithm sldns_cert_algorithm;
427 
428 /**
429  * EDNS option codes
430  */
431 enum sldns_enum_edns_option
432 {
433 	LDNS_EDNS_LLQ = 1, /* http://files.dns-sd.org/draft-sekar-dns-llq.txt */
434 	LDNS_EDNS_UL = 2, /* http://files.dns-sd.org/draft-sekar-dns-ul.txt */
435 	LDNS_EDNS_NSID = 3, /* RFC5001 */
436 	/* 4 draft-cheshire-edns0-owner-option */
437 	LDNS_EDNS_DAU = 5, /* RFC6975 */
438 	LDNS_EDNS_DHU = 6, /* RFC6975 */
439 	LDNS_EDNS_N3U = 7, /* RFC6975 */
440 	LDNS_EDNS_CLIENT_SUBNET = 8, /* RFC7871 */
441 	LDNS_EDNS_COOKIE = 10, /* RFC7873 */
442 	LDNS_EDNS_KEEPALIVE = 11, /* draft-ietf-dnsop-edns-tcp-keepalive*/
443 	LDNS_EDNS_PADDING = 12, /* RFC7830 */
444 	LDNS_EDNS_EDE = 15, /* RFC8914 */
445 	LDNS_EDNS_CLIENT_TAG = 16, /* draft-bellis-dnsop-edns-tags-01 */
446 	LDNS_EDNS_REPORT_CHANNEL = 18, /* RFC9567 */
447 	LDNS_EDNS_UNBOUND_CACHEDB_TESTFRAME_TEST = 65534
448 };
449 typedef enum sldns_enum_edns_option sldns_edns_option;
450 
451 enum sldns_enum_ede_code
452 {
453 	LDNS_EDE_NONE = -1, /* EDE undefined for internal use */
454 	LDNS_EDE_OTHER = 0,
455 	LDNS_EDE_UNSUPPORTED_DNSKEY_ALG = 1,
456 	LDNS_EDE_UNSUPPORTED_DS_DIGEST = 2,
457 	LDNS_EDE_STALE_ANSWER = 3,
458 	LDNS_EDE_FORGED_ANSWER = 4,
459 	LDNS_EDE_DNSSEC_INDETERMINATE = 5,
460 	LDNS_EDE_DNSSEC_BOGUS = 6,
461 	LDNS_EDE_SIGNATURE_EXPIRED = 7,
462 	LDNS_EDE_SIGNATURE_NOT_YET_VALID = 8,
463 	LDNS_EDE_DNSKEY_MISSING = 9,
464 	LDNS_EDE_RRSIGS_MISSING = 10,
465 	LDNS_EDE_NO_ZONE_KEY_BIT_SET = 11,
466 	LDNS_EDE_NSEC_MISSING = 12,
467 	LDNS_EDE_CACHED_ERROR = 13,
468 	LDNS_EDE_NOT_READY = 14,
469 	LDNS_EDE_BLOCKED = 15,
470 	LDNS_EDE_CENSORED = 16,
471 	LDNS_EDE_FILTERED = 17,
472 	LDNS_EDE_PROHIBITED = 18,
473 	LDNS_EDE_STALE_NXDOMAIN_ANSWER = 19,
474 	LDNS_EDE_NOT_AUTHORITATIVE = 20,
475 	LDNS_EDE_NOT_SUPPORTED = 21,
476 	LDNS_EDE_NO_REACHABLE_AUTHORITY = 22,
477 	LDNS_EDE_NETWORK_ERROR = 23,
478 	LDNS_EDE_INVALID_DATA = 24,
479 	LDNS_EDE_SIGNATURE_EXPIRED_BEFORE_VALID = 25,
480 	LDNS_EDE_TOO_EARLY = 26,
481 	LDNS_EDE_UNSUPPORTED_NSEC3_ITERATIONS = 27,
482 	LDNS_EDE_BADPROXYPOLICY = 28,
483 	LDNS_EDE_SYNTHESIZED = 29
484 };
485 typedef enum sldns_enum_ede_code sldns_ede_code;
486 
487 #define LDNS_EDNS_MASK_DO_BIT 0x8000
488 
489 /** TSIG and TKEY extended rcodes (16bit), 0-15 are the normal rcodes. */
490 #define LDNS_TSIG_ERROR_NOERROR  0
491 #define LDNS_TSIG_ERROR_BADSIG   16
492 #define LDNS_TSIG_ERROR_BADKEY   17
493 #define LDNS_TSIG_ERROR_BADTIME  18
494 #define LDNS_TSIG_ERROR_BADMODE  19
495 #define LDNS_TSIG_ERROR_BADNAME  20
496 #define LDNS_TSIG_ERROR_BADALG   21
497 
498 /** DNS Cookie extended rcode */
499 #define LDNS_EXT_RCODE_BADCOOKIE 23
500 
501 /**
502  * Contains all information about resource record types.
503  *
504  * This structure contains, for all rr types, the rdata fields that are defined.
505  */
506 struct sldns_struct_rr_descriptor
507 {
508 	/** Type of the RR that is described here */
509 	sldns_rr_type    _type;
510 	/** Textual name of the RR type.  */
511 	const char *_name;
512 	/** Minimum number of rdata fields in the RRs of this type.  */
513 	uint8_t     _minimum;
514 	/** Maximum number of rdata fields in the RRs of this type.  */
515 	uint8_t     _maximum;
516 	/** Wireformat specification for the rr, i.e. the types of rdata fields in their respective order. */
517 	const sldns_rdf_type *_wireformat;
518 	/** Special rdf types */
519 	sldns_rdf_type _variable;
520 	/** Specifies whether compression can be used for dnames in this RR type. */
521 	sldns_rr_compress _compress;
522 	/** The number of DNAMEs in the _wireformat string, for parsing. */
523 	uint8_t _dname_count;
524 };
525 typedef struct sldns_struct_rr_descriptor sldns_rr_descriptor;
526 
527 /**
528  * returns the resource record descriptor for the given rr type.
529  *
530  * \param[in] type the type value of the rr type
531  *\return the sldns_rr_descriptor for this type
532  */
533 const sldns_rr_descriptor *sldns_rr_descript(uint16_t type);
534 
535 /**
536  * returns the minimum number of rdata fields of the rr type this descriptor describes.
537  *
538  * \param[in]  descriptor for an rr type
539  * \return the minimum number of rdata fields
540  */
541 size_t sldns_rr_descriptor_minimum(const sldns_rr_descriptor *descriptor);
542 
543 /**
544  * returns the maximum number of rdata fields of the rr type this descriptor describes.
545  *
546  * \param[in]  descriptor for an rr type
547  * \return the maximum number of rdata fields
548  */
549 size_t sldns_rr_descriptor_maximum(const sldns_rr_descriptor *descriptor);
550 
551 /**
552  * returns the rdf type for the given rdata field number of the rr type for the given descriptor.
553  *
554  * \param[in] descriptor for an rr type
555  * \param[in] field the field number
556  * \return the rdf type for the field
557  */
558 sldns_rdf_type sldns_rr_descriptor_field_type(const sldns_rr_descriptor *descriptor, size_t field);
559 
560 /**
561  * retrieves a rrtype by looking up its name.
562  * \param[in] name a string with the name
563  * \return the type which corresponds with the name
564  */
565 sldns_rr_type sldns_get_rr_type_by_name(const char *name);
566 
567 /**
568  * retrieves a class by looking up its name.
569  * \param[in] name string with the name
570  * \return the cass which corresponds with the name
571  */
572 sldns_rr_class sldns_get_rr_class_by_name(const char *name);
573 
574 #ifdef __cplusplus
575 }
576 #endif
577 
578 #endif /* LDNS_RRDEF_H */
579