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