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