1 /* This file was generated by running 'make_rr_types_h.pl rr_types.in'. 2 Modifications to this file may be lost the next time it is automatically 3 regenerated. 4 */ 5 6 /* rr_types.h - A header file with names & descriptions of 7 all rr types known to pdnsd 8 Copyright (C) 2000, 2001 Thomas Moestl 9 Copyright (C) 2007, 2010, 2011 Paul A. Rombouts 10 11 This file is part of the pdnsd package. 12 13 pdnsd is free software; you can redistribute it and/or modify 14 it under the terms of the GNU General Public License as published by 15 the Free Software Foundation; either version 3 of the License, or 16 (at your option) any later version. 17 18 pdnsd is distributed in the hope that it will be useful, 19 but WITHOUT ANY WARRANTY; without even the implied warranty of 20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 GNU General Public License for more details. 22 23 You should have received a copy of the GNU General Public License 24 along with pdnsd; see the file COPYING. If not, see 25 <http://www.gnu.org/licenses/>. 26 */ 27 28 #ifndef _RR_TYPES_H_ 29 #define _RR_TYPES_H_ 30 31 #include <config.h> 32 33 #define T_MIN 1 34 #define T_A 1 35 #define T_NS 2 36 #define T_MD 3 37 #define T_MF 4 38 #define T_CNAME 5 39 #define T_SOA 6 40 #define T_MB 7 41 #define T_MG 8 42 #define T_MR 9 43 #define T_NULL 10 44 #define T_WKS 11 45 #define T_PTR 12 46 #define T_HINFO 13 47 #define T_MINFO 14 48 #define T_MX 15 49 #define T_TXT 16 50 #define T_RP 17 51 #define T_AFSDB 18 52 #define T_X25 19 53 #define T_ISDN 20 54 #define T_RT 21 55 #define T_NSAP 22 56 #define T_NSAP_PTR 23 57 #define T_SIG 24 58 #define T_KEY 25 59 #define T_PX 26 60 #define T_GPOS 27 61 #define T_AAAA 28 62 #define T_LOC 29 63 #define T_NXT 30 64 #define T_EID 31 65 #define T_NIMLOC 32 66 #define T_SRV 33 67 #define T_ATMA 34 68 #define T_NAPTR 35 69 #define T_KX 36 70 #define T_CERT 37 71 #define T_A6 38 72 #define T_DNAME 39 73 #define T_SINK 40 74 #define T_OPT 41 75 #define T_APL 42 76 #define T_DS 43 77 #define T_SSHFP 44 78 #define T_IPSECKEY 45 79 #define T_RRSIG 46 80 #define T_NSEC 47 81 #define T_DNSKEY 48 82 #define T_DHCID 49 83 #define T_NSEC3 50 84 #define T_NSEC3PARAM 51 85 #define T_HIP 55 86 #define T_NINFO 56 87 #define T_RKEY 57 88 #define T_TALINK 58 89 #define T_SPF 99 90 #define T_UINFO 100 91 #define T_UID 101 92 #define T_GID 102 93 #define T_UNSPEC 103 94 #define T_MAX 51 95 96 /* T_MAX - T_MIN + 1 */ 97 #define T_NUM 51 98 99 /* Number of most frequently used rr types. */ 100 #define NRRMU 8 101 102 /* Number of remaining rr types. */ 103 #define NRREXT 39 104 105 /* NRRMU + NRREXT */ 106 #define NRRTOT 47 107 108 /* Lookup table for converting rr type values to internally used indices. */ 109 extern const unsigned short int rrlkuptab[T_NUM]; 110 #if DEFINE_RR_TYPE_ARRAYS && !defined(CLIENT_ONLY) 111 const unsigned short int rrlkuptab[T_NUM] = { 112 0 /* A */, 113 1 /* NS */, 114 8 /* MD */, 115 9 /* MF */, 116 2 /* CNAME */, 117 3 /* SOA */, 118 10 /* MB */, 119 11 /* MG */, 120 12 /* MR */, 121 13 /* NULL */, 122 14 /* WKS */, 123 4 /* PTR */, 124 15 /* HINFO */, 125 16 /* MINFO */, 126 5 /* MX */, 127 6 /* TXT */, 128 17 /* RP */, 129 18 /* AFSDB */, 130 19 /* X25 */, 131 20 /* ISDN */, 132 21 /* RT */, 133 22 /* NSAP */, 134 23 /* NSAP_PTR */, 135 24 /* SIG */, 136 25 /* KEY */, 137 26 /* PX */, 138 27 /* GPOS */, 139 7 /* AAAA */, 140 28 /* LOC */, 141 29 /* NXT */, 142 30 /* EID */, 143 31 /* NIMLOC */, 144 32 /* SRV */, 145 33 /* ATMA */, 146 34 /* NAPTR */, 147 35 /* KX */, 148 36 /* CERT */, 149 47 /* A6 */, 150 48 /* DNAME */, 151 49 /* SINK */, 152 50 /* OPT */, 153 37 /* APL */, 154 38 /* DS */, 155 39 /* SSHFP */, 156 40 /* IPSECKEY */, 157 41 /* RRSIG */, 158 42 /* NSEC */, 159 43 /* DNSKEY */, 160 44 /* DHCID */, 161 45 /* NSEC3 */, 162 46 /* NSEC3PARAM */ 163 }; 164 #endif 165 166 /* List of most frequently used RR types in ascending order. */ 167 extern const unsigned short int rrmuiterlist[NRRMU]; 168 #if DEFINE_RR_TYPE_ARRAYS && !defined(CLIENT_ONLY) 169 const unsigned short int rrmuiterlist[NRRMU] = { 170 T_A, 171 T_NS, 172 T_CNAME, 173 T_SOA, 174 T_PTR, 175 T_MX, 176 T_TXT, 177 T_AAAA 178 }; 179 #endif 180 181 /* List of the cache-able RR types in ascending order. */ 182 extern const unsigned short int rrcachiterlist[NRRTOT]; 183 #if DEFINE_RR_TYPE_ARRAYS 184 const unsigned short int rrcachiterlist[NRRTOT] = { 185 T_A, 186 T_NS, 187 T_MD, 188 T_MF, 189 T_CNAME, 190 T_SOA, 191 T_MB, 192 T_MG, 193 T_MR, 194 T_NULL, 195 T_WKS, 196 T_PTR, 197 T_HINFO, 198 T_MINFO, 199 T_MX, 200 T_TXT, 201 T_RP, 202 T_AFSDB, 203 T_X25, 204 T_ISDN, 205 T_RT, 206 T_NSAP, 207 T_NSAP_PTR, 208 T_SIG, 209 T_KEY, 210 T_PX, 211 T_GPOS, 212 T_AAAA, 213 T_LOC, 214 T_NXT, 215 T_EID, 216 T_NIMLOC, 217 T_SRV, 218 T_ATMA, 219 T_NAPTR, 220 T_KX, 221 T_CERT, 222 T_APL, 223 T_DS, 224 T_SSHFP, 225 T_IPSECKEY, 226 T_RRSIG, 227 T_NSEC, 228 T_DNSKEY, 229 T_DHCID, 230 T_NSEC3, 231 T_NSEC3PARAM 232 }; 233 #endif 234 235 /* Optimized getrrset macros for fixed rr types. */ 236 #define getrrset_A(cent) GET_RRSMU(cent,0) 237 #define getrrset_NS(cent) GET_RRSMU(cent,1) 238 #define getrrset_MD(cent) GET_RRSEXT(cent,0) 239 #define getrrset_MF(cent) GET_RRSEXT(cent,1) 240 #define getrrset_CNAME(cent) GET_RRSMU(cent,2) 241 #define getrrset_SOA(cent) GET_RRSMU(cent,3) 242 #define getrrset_MB(cent) GET_RRSEXT(cent,2) 243 #define getrrset_MG(cent) GET_RRSEXT(cent,3) 244 #define getrrset_MR(cent) GET_RRSEXT(cent,4) 245 #define getrrset_NULL(cent) GET_RRSEXT(cent,5) 246 #define getrrset_WKS(cent) GET_RRSEXT(cent,6) 247 #define getrrset_PTR(cent) GET_RRSMU(cent,4) 248 #define getrrset_HINFO(cent) GET_RRSEXT(cent,7) 249 #define getrrset_MINFO(cent) GET_RRSEXT(cent,8) 250 #define getrrset_MX(cent) GET_RRSMU(cent,5) 251 #define getrrset_TXT(cent) GET_RRSMU(cent,6) 252 #define getrrset_RP(cent) GET_RRSEXT(cent,9) 253 #define getrrset_AFSDB(cent) GET_RRSEXT(cent,10) 254 #define getrrset_X25(cent) GET_RRSEXT(cent,11) 255 #define getrrset_ISDN(cent) GET_RRSEXT(cent,12) 256 #define getrrset_RT(cent) GET_RRSEXT(cent,13) 257 #define getrrset_NSAP(cent) GET_RRSEXT(cent,14) 258 #define getrrset_NSAP_PTR(cent) GET_RRSEXT(cent,15) 259 #define getrrset_SIG(cent) GET_RRSEXT(cent,16) 260 #define getrrset_KEY(cent) GET_RRSEXT(cent,17) 261 #define getrrset_PX(cent) GET_RRSEXT(cent,18) 262 #define getrrset_GPOS(cent) GET_RRSEXT(cent,19) 263 #define getrrset_AAAA(cent) GET_RRSMU(cent,7) 264 #define getrrset_LOC(cent) GET_RRSEXT(cent,20) 265 #define getrrset_NXT(cent) GET_RRSEXT(cent,21) 266 #define getrrset_EID(cent) GET_RRSEXT(cent,22) 267 #define getrrset_NIMLOC(cent) GET_RRSEXT(cent,23) 268 #define getrrset_SRV(cent) GET_RRSEXT(cent,24) 269 #define getrrset_ATMA(cent) GET_RRSEXT(cent,25) 270 #define getrrset_NAPTR(cent) GET_RRSEXT(cent,26) 271 #define getrrset_KX(cent) GET_RRSEXT(cent,27) 272 #define getrrset_CERT(cent) GET_RRSEXT(cent,28) 273 #define getrrset_APL(cent) GET_RRSEXT(cent,29) 274 #define getrrset_DS(cent) GET_RRSEXT(cent,30) 275 #define getrrset_SSHFP(cent) GET_RRSEXT(cent,31) 276 #define getrrset_IPSECKEY(cent) GET_RRSEXT(cent,32) 277 #define getrrset_RRSIG(cent) GET_RRSEXT(cent,33) 278 #define getrrset_NSEC(cent) GET_RRSEXT(cent,34) 279 #define getrrset_DNSKEY(cent) GET_RRSEXT(cent,35) 280 #define getrrset_DHCID(cent) GET_RRSEXT(cent,36) 281 #define getrrset_NSEC3(cent) GET_RRSEXT(cent,37) 282 #define getrrset_NSEC3PARAM(cent) GET_RRSEXT(cent,38) 283 284 /* have_rr macros for fixed rr types. */ 285 #define have_rr_A(cent) HAVE_RRMU(cent,0) 286 #define have_rr_NS(cent) HAVE_RRMU(cent,1) 287 #define have_rr_MD(cent) HAVE_RREXT(cent,0) 288 #define have_rr_MF(cent) HAVE_RREXT(cent,1) 289 #define have_rr_CNAME(cent) HAVE_RRMU(cent,2) 290 #define have_rr_SOA(cent) HAVE_RRMU(cent,3) 291 #define have_rr_MB(cent) HAVE_RREXT(cent,2) 292 #define have_rr_MG(cent) HAVE_RREXT(cent,3) 293 #define have_rr_MR(cent) HAVE_RREXT(cent,4) 294 #define have_rr_NULL(cent) HAVE_RREXT(cent,5) 295 #define have_rr_WKS(cent) HAVE_RREXT(cent,6) 296 #define have_rr_PTR(cent) HAVE_RRMU(cent,4) 297 #define have_rr_HINFO(cent) HAVE_RREXT(cent,7) 298 #define have_rr_MINFO(cent) HAVE_RREXT(cent,8) 299 #define have_rr_MX(cent) HAVE_RRMU(cent,5) 300 #define have_rr_TXT(cent) HAVE_RRMU(cent,6) 301 #define have_rr_RP(cent) HAVE_RREXT(cent,9) 302 #define have_rr_AFSDB(cent) HAVE_RREXT(cent,10) 303 #define have_rr_X25(cent) HAVE_RREXT(cent,11) 304 #define have_rr_ISDN(cent) HAVE_RREXT(cent,12) 305 #define have_rr_RT(cent) HAVE_RREXT(cent,13) 306 #define have_rr_NSAP(cent) HAVE_RREXT(cent,14) 307 #define have_rr_NSAP_PTR(cent) HAVE_RREXT(cent,15) 308 #define have_rr_SIG(cent) HAVE_RREXT(cent,16) 309 #define have_rr_KEY(cent) HAVE_RREXT(cent,17) 310 #define have_rr_PX(cent) HAVE_RREXT(cent,18) 311 #define have_rr_GPOS(cent) HAVE_RREXT(cent,19) 312 #define have_rr_AAAA(cent) HAVE_RRMU(cent,7) 313 #define have_rr_LOC(cent) HAVE_RREXT(cent,20) 314 #define have_rr_NXT(cent) HAVE_RREXT(cent,21) 315 #define have_rr_EID(cent) HAVE_RREXT(cent,22) 316 #define have_rr_NIMLOC(cent) HAVE_RREXT(cent,23) 317 #define have_rr_SRV(cent) HAVE_RREXT(cent,24) 318 #define have_rr_ATMA(cent) HAVE_RREXT(cent,25) 319 #define have_rr_NAPTR(cent) HAVE_RREXT(cent,26) 320 #define have_rr_KX(cent) HAVE_RREXT(cent,27) 321 #define have_rr_CERT(cent) HAVE_RREXT(cent,28) 322 #define have_rr_A6(cent) 0 323 #define have_rr_DNAME(cent) 0 324 #define have_rr_SINK(cent) 0 325 #define have_rr_OPT(cent) 0 326 #define have_rr_APL(cent) HAVE_RREXT(cent,29) 327 #define have_rr_DS(cent) HAVE_RREXT(cent,30) 328 #define have_rr_SSHFP(cent) HAVE_RREXT(cent,31) 329 #define have_rr_IPSECKEY(cent) HAVE_RREXT(cent,32) 330 #define have_rr_RRSIG(cent) HAVE_RREXT(cent,33) 331 #define have_rr_NSEC(cent) HAVE_RREXT(cent,34) 332 #define have_rr_DNSKEY(cent) HAVE_RREXT(cent,35) 333 #define have_rr_DHCID(cent) HAVE_RREXT(cent,36) 334 #define have_rr_NSEC3(cent) HAVE_RREXT(cent,37) 335 #define have_rr_NSEC3PARAM(cent) HAVE_RREXT(cent,38) 336 337 /* These macros specify which RR types are cached by pdnsd. */ 338 #define IS_CACHED_A 1 339 #define IS_CACHED_NS 1 340 #define IS_CACHED_MD 1 341 #define IS_CACHED_MF 1 342 #define IS_CACHED_CNAME 1 343 #define IS_CACHED_SOA 1 344 #define IS_CACHED_MB 1 345 #define IS_CACHED_MG 1 346 #define IS_CACHED_MR 1 347 #define IS_CACHED_NULL 1 348 #define IS_CACHED_WKS 1 349 #define IS_CACHED_PTR 1 350 #define IS_CACHED_HINFO 1 351 #define IS_CACHED_MINFO 1 352 #define IS_CACHED_MX 1 353 #define IS_CACHED_TXT 1 354 #define IS_CACHED_RP 1 355 #define IS_CACHED_AFSDB 1 356 #define IS_CACHED_X25 1 357 #define IS_CACHED_ISDN 1 358 #define IS_CACHED_RT 1 359 #define IS_CACHED_NSAP 1 360 #define IS_CACHED_NSAP_PTR 1 361 #define IS_CACHED_SIG 1 362 #define IS_CACHED_KEY 1 363 #define IS_CACHED_PX 1 364 #define IS_CACHED_GPOS 1 365 #define IS_CACHED_AAAA 1 366 #define IS_CACHED_LOC 1 367 #define IS_CACHED_NXT 1 368 #define IS_CACHED_EID 1 369 #define IS_CACHED_NIMLOC 1 370 #define IS_CACHED_SRV 1 371 #define IS_CACHED_ATMA 1 372 #define IS_CACHED_NAPTR 1 373 #define IS_CACHED_KX 1 374 #define IS_CACHED_CERT 1 375 #define IS_CACHED_APL 1 376 #define IS_CACHED_DS 1 377 #define IS_CACHED_SSHFP 1 378 #define IS_CACHED_IPSECKEY 1 379 #define IS_CACHED_RRSIG 1 380 #define IS_CACHED_NSEC 1 381 #define IS_CACHED_DNSKEY 1 382 #define IS_CACHED_DHCID 1 383 #define IS_CACHED_NSEC3 1 384 #define IS_CACHED_NSEC3PARAM 1 385 386 /* Array indices for most frequently used rr types. */ 387 #define RRMUINDEX_A 0 388 #define RRMUINDEX_NS 1 389 #define RRMUINDEX_CNAME 2 390 #define RRMUINDEX_SOA 3 391 #define RRMUINDEX_PTR 4 392 #define RRMUINDEX_MX 5 393 #define RRMUINDEX_TXT 6 394 #define RRMUINDEX_AAAA 7 395 396 /* Table of rr names. */ 397 extern const char *const rrnames[T_NUM]; 398 #if DEFINE_RR_TYPE_ARRAYS 399 const char *const rrnames[T_NUM] = { 400 "A", 401 "NS", 402 "MD", 403 "MF", 404 "CNAME", 405 "SOA", 406 "MB", 407 "MG", 408 "MR", 409 "NULL", 410 "WKS", 411 "PTR", 412 "HINFO", 413 "MINFO", 414 "MX", 415 "TXT", 416 "RP", 417 "AFSDB", 418 "X25", 419 "ISDN", 420 "RT", 421 "NSAP", 422 "NSAP_PTR", 423 "SIG", 424 "KEY", 425 "PX", 426 "GPOS", 427 "AAAA", 428 "LOC", 429 "NXT", 430 "EID", 431 "NIMLOC", 432 "SRV", 433 "ATMA", 434 "NAPTR", 435 "KX", 436 "CERT", 437 "A6", 438 "DNAME", 439 "SINK", 440 "OPT", 441 "APL", 442 "DS", 443 "SSHFP", 444 "IPSECKEY", 445 "RRSIG", 446 "NSEC", 447 "DNSKEY", 448 "DHCID", 449 "NSEC3", 450 "NSEC3PARAM" 451 }; 452 #endif 453 454 /* Structure for rr information */ 455 struct rr_infos { 456 unsigned short class; /* class (values see below) */ 457 unsigned short excludes; /* relations to other classes. 458 Mutual exclusion is marked by or'ing the 459 respective RRCL value in this field. 460 Exclusions should be symmetric. */ 461 }; 462 463 /* Class values */ 464 #define RRCL_ALIAS 1 /* for CNAMES, conflicts with RRCL_RECORD */ 465 #define RRCL_RECORD 2 /* normal direct record */ 466 #define RRCL_IDEM 4 /* types that conflict with no others (MX, CNAME, ...) */ 467 #define RRCL_PTR 8 /* PTR */ 468 469 /* Standard excludes for the classes */ 470 #define RRX_ALIAS (RRCL_RECORD|RRCL_PTR) 471 #define RRX_RECORD (RRCL_ALIAS|RRCL_PTR) 472 #define RRX_IDEM 0 473 #define RRX_PTR (RRCL_ALIAS|RRCL_RECORD) 474 475 /* There could be a separate table detailing the relationship of types, but this 476 * is slightly more flexible, as it allows a finer granularity of exclusion. Also, 477 * Membership in multiple classes could be added. 478 * Index by internally used RR-set indices, not RR type values! 479 */ 480 extern const struct rr_infos rr_info[NRRTOT]; 481 #if DEFINE_RR_TYPE_ARRAYS && !defined(CLIENT_ONLY) 482 const struct rr_infos rr_info[NRRTOT] = { 483 {RRCL_RECORD, RRX_RECORD} /* A */, 484 {RRCL_IDEM, RRX_IDEM} /* NS */, 485 {RRCL_ALIAS, RRX_ALIAS} /* CNAME */, 486 {RRCL_IDEM, RRX_IDEM} /* SOA */, 487 {RRCL_PTR, RRX_PTR} /* PTR */, 488 {RRCL_IDEM, RRX_IDEM} /* MX */, 489 {RRCL_IDEM, RRX_IDEM} /* TXT */, 490 {RRCL_RECORD, RRX_RECORD} /* AAAA */, 491 {RRCL_IDEM, RRX_IDEM} /* MD */, 492 {RRCL_IDEM, RRX_IDEM} /* MF */, 493 {RRCL_IDEM, RRX_IDEM} /* MB */, 494 {RRCL_IDEM, RRX_IDEM} /* MG */, 495 {RRCL_IDEM, RRX_IDEM} /* MR */, 496 {RRCL_IDEM, RRX_IDEM} /* NULL */, 497 {RRCL_RECORD, RRX_RECORD} /* WKS */, 498 {RRCL_RECORD, RRX_RECORD} /* HINFO */, 499 {RRCL_IDEM, RRX_IDEM} /* MINFO */, 500 {RRCL_RECORD, RRX_RECORD} /* RP */, 501 {RRCL_RECORD, RRX_RECORD} /* AFSDB */, 502 {RRCL_RECORD, RRX_RECORD} /* X25 */, 503 {RRCL_RECORD, RRX_RECORD} /* ISDN */, 504 {RRCL_RECORD, RRX_RECORD} /* RT */, 505 {RRCL_RECORD, RRX_RECORD} /* NSAP */, 506 {RRCL_PTR, RRX_PTR} /* NSAP_PTR */, 507 {RRCL_IDEM, RRX_IDEM} /* SIG */, 508 {RRCL_IDEM, RRX_IDEM} /* KEY */, 509 {RRCL_IDEM, RRX_IDEM} /* PX */, 510 {RRCL_RECORD, RRX_RECORD} /* GPOS */, 511 {RRCL_RECORD, RRX_RECORD} /* LOC */, 512 {RRCL_IDEM, RRX_IDEM} /* NXT */, 513 {RRCL_RECORD, RRX_RECORD} /* EID */, 514 {RRCL_RECORD, RRX_RECORD} /* NIMLOC */, 515 {RRCL_RECORD, RRX_RECORD} /* SRV */, 516 {RRCL_RECORD, RRX_RECORD} /* ATMA */, 517 {RRCL_RECORD, RRX_RECORD} /* NAPTR */, 518 {RRCL_RECORD, RRX_RECORD} /* KX */, 519 {RRCL_RECORD, RRX_RECORD} /* CERT */, 520 {RRCL_IDEM, RRX_IDEM} /* APL */, 521 {RRCL_IDEM, RRX_IDEM} /* DS */, 522 {RRCL_IDEM, RRX_IDEM} /* SSHFP */, 523 {RRCL_IDEM, RRX_IDEM} /* IPSECKEY */, 524 {RRCL_IDEM, RRX_IDEM} /* RRSIG */, 525 {RRCL_IDEM, RRX_IDEM} /* NSEC */, 526 {RRCL_IDEM, RRX_IDEM} /* DNSKEY */, 527 {RRCL_IDEM, RRX_IDEM} /* DHCID */, 528 {RRCL_IDEM, RRX_IDEM} /* NSEC3 */, 529 {RRCL_IDEM, RRX_IDEM} /* NSEC3PARAM */ 530 }; 531 #endif 532 533 int rr_tp_byname(char *name); 534 const char *loc2str(const void *binary, char *ascii, size_t asclen); 535 536 #endif 537