1 2 #ifndef ARES_NAMESER_H 3 #define ARES_NAMESER_H 4 5 #include "ares_build.h" 6 7 #ifdef CARES_HAVE_ARPA_NAMESER_H 8 # include <arpa/nameser.h> 9 #endif 10 #ifdef CARES_HAVE_ARPA_NAMESER_COMPAT_H 11 # include <arpa/nameser_compat.h> 12 #endif 13 14 /* ============================================================================ 15 * arpa/nameser.h may or may not provide ALL of the below defines, so check 16 * each one individually and set if not 17 * ============================================================================ 18 */ 19 20 #ifndef NS_PACKETSZ 21 # define NS_PACKETSZ 512 /* maximum packet size */ 22 #endif 23 24 #ifndef NS_MAXDNAME 25 # define NS_MAXDNAME 256 /* maximum domain name */ 26 #endif 27 28 #ifndef NS_MAXCDNAME 29 # define NS_MAXCDNAME 255 /* maximum compressed domain name */ 30 #endif 31 32 #ifndef NS_MAXLABEL 33 # define NS_MAXLABEL 63 34 #endif 35 36 #ifndef NS_HFIXEDSZ 37 # define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */ 38 #endif 39 40 #ifndef NS_QFIXEDSZ 41 # define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */ 42 #endif 43 44 #ifndef NS_RRFIXEDSZ 45 # define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */ 46 #endif 47 48 #ifndef NS_INT16SZ 49 # define NS_INT16SZ 2 50 #endif 51 52 #ifndef NS_INADDRSZ 53 # define NS_INADDRSZ 4 54 #endif 55 56 #ifndef NS_IN6ADDRSZ 57 # define NS_IN6ADDRSZ 16 58 #endif 59 60 #ifndef NS_CMPRSFLGS 61 # define NS_CMPRSFLGS 0xc0 /* Flag bits indicating name compression. */ 62 #endif 63 64 #ifndef NS_DEFAULTPORT 65 # define NS_DEFAULTPORT 53 /* For both TCP and UDP. */ 66 #endif 67 68 /* ============================================================================ 69 * arpa/nameser.h should provide these enumerations always, so if not found, 70 * provide them 71 * ============================================================================ 72 */ 73 #ifndef CARES_HAVE_ARPA_NAMESER_H 74 75 typedef enum __ns_class { 76 ns_c_invalid = 0, /* Cookie. */ 77 ns_c_in = 1, /* Internet. */ 78 ns_c_2 = 2, /* unallocated/unsupported. */ 79 ns_c_chaos = 3, /* MIT Chaos-net. */ 80 ns_c_hs = 4, /* MIT Hesiod. */ 81 /* Query class values which do not appear in resource records */ 82 ns_c_none = 254, /* for prereq. sections in update requests */ 83 ns_c_any = 255, /* Wildcard match. */ 84 ns_c_max = 65536 85 } ns_class; 86 87 typedef enum __ns_type { 88 ns_t_invalid = 0, /* Cookie. */ 89 ns_t_a = 1, /* Host address. */ 90 ns_t_ns = 2, /* Authoritative server. */ 91 ns_t_md = 3, /* Mail destination. */ 92 ns_t_mf = 4, /* Mail forwarder. */ 93 ns_t_cname = 5, /* Canonical name. */ 94 ns_t_soa = 6, /* Start of authority zone. */ 95 ns_t_mb = 7, /* Mailbox domain name. */ 96 ns_t_mg = 8, /* Mail group member. */ 97 ns_t_mr = 9, /* Mail rename name. */ 98 ns_t_null = 10, /* Null resource record. */ 99 ns_t_wks = 11, /* Well known service. */ 100 ns_t_ptr = 12, /* Domain name pointer. */ 101 ns_t_hinfo = 13, /* Host information. */ 102 ns_t_minfo = 14, /* Mailbox information. */ 103 ns_t_mx = 15, /* Mail routing information. */ 104 ns_t_txt = 16, /* Text strings. */ 105 ns_t_rp = 17, /* Responsible person. */ 106 ns_t_afsdb = 18, /* AFS cell database. */ 107 ns_t_x25 = 19, /* X_25 calling address. */ 108 ns_t_isdn = 20, /* ISDN calling address. */ 109 ns_t_rt = 21, /* Router. */ 110 ns_t_nsap = 22, /* NSAP address. */ 111 ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */ 112 ns_t_sig = 24, /* Security signature. */ 113 ns_t_key = 25, /* Security key. */ 114 ns_t_px = 26, /* X.400 mail mapping. */ 115 ns_t_gpos = 27, /* Geographical position (withdrawn). */ 116 ns_t_aaaa = 28, /* Ip6 Address. */ 117 ns_t_loc = 29, /* Location Information. */ 118 ns_t_nxt = 30, /* Next domain (security). */ 119 ns_t_eid = 31, /* Endpoint identifier. */ 120 ns_t_nimloc = 32, /* Nimrod Locator. */ 121 ns_t_srv = 33, /* Server Selection. */ 122 ns_t_atma = 34, /* ATM Address */ 123 ns_t_naptr = 35, /* Naming Authority PoinTeR */ 124 ns_t_kx = 36, /* Key Exchange */ 125 ns_t_cert = 37, /* Certification record */ 126 ns_t_a6 = 38, /* IPv6 address (deprecates AAAA) */ 127 ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */ 128 ns_t_sink = 40, /* Kitchen sink (experimentatl) */ 129 ns_t_opt = 41, /* EDNS0 option (meta-RR) */ 130 ns_t_apl = 42, /* Address prefix list (RFC3123) */ 131 ns_t_ds = 43, /* Delegation Signer (RFC4034) */ 132 ns_t_sshfp = 44, /* SSH Key Fingerprint (RFC4255) */ 133 ns_t_rrsig = 46, /* Resource Record Signature (RFC4034) */ 134 ns_t_nsec = 47, /* Next Secure (RFC4034) */ 135 ns_t_dnskey = 48, /* DNS Public Key (RFC4034) */ 136 ns_t_tkey = 249, /* Transaction key */ 137 ns_t_tsig = 250, /* Transaction signature. */ 138 ns_t_ixfr = 251, /* Incremental zone transfer. */ 139 ns_t_axfr = 252, /* Transfer zone of authority. */ 140 ns_t_mailb = 253, /* Transfer mailbox records. */ 141 ns_t_maila = 254, /* Transfer mail agent records. */ 142 ns_t_any = 255, /* Wildcard match. */ 143 ns_t_uri = 256, /* Uniform Resource Identifier (RFC7553) */ 144 ns_t_caa = 257, /* Certification Authority Authorization. */ 145 ns_t_max = 65536 146 } ns_type; 147 148 typedef enum __ns_opcode { 149 ns_o_query = 0, /* Standard query. */ 150 ns_o_iquery = 1, /* Inverse query (deprecated/unsupported). */ 151 ns_o_status = 2, /* Name server status query (unsupported). */ 152 /* Opcode 3 is undefined/reserved. */ 153 ns_o_notify = 4, /* Zone change notification. */ 154 ns_o_update = 5, /* Zone update message. */ 155 ns_o_max = 6 156 } ns_opcode; 157 158 typedef enum __ns_rcode { 159 ns_r_noerror = 0, /* No error occurred. */ 160 ns_r_formerr = 1, /* Format error. */ 161 ns_r_servfail = 2, /* Server failure. */ 162 ns_r_nxdomain = 3, /* Name error. */ 163 ns_r_notimpl = 4, /* Unimplemented. */ 164 ns_r_refused = 5, /* Operation refused. */ 165 /* these are for BIND_UPDATE */ 166 ns_r_yxdomain = 6, /* Name exists */ 167 ns_r_yxrrset = 7, /* RRset exists */ 168 ns_r_nxrrset = 8, /* RRset does not exist */ 169 ns_r_notauth = 9, /* Not authoritative for zone */ 170 ns_r_notzone = 10, /* Zone of record different from zone section */ 171 ns_r_max = 11, 172 /* The following are TSIG extended errors */ 173 ns_r_badsig = 16, 174 ns_r_badkey = 17, 175 ns_r_badtime = 18 176 } ns_rcode; 177 178 #endif /* CARES_HAVE_ARPA_NAMESER_H */ 179 180 181 /* ============================================================================ 182 * arpa/nameser_compat.h typically sets these. However on some systems 183 * arpa/nameser.h does, but may not set all of them. Lets conditionally 184 * define each 185 * ============================================================================ 186 */ 187 188 #ifndef PACKETSZ 189 # define PACKETSZ NS_PACKETSZ 190 #endif 191 192 #ifndef MAXDNAME 193 # define MAXDNAME NS_MAXDNAME 194 #endif 195 196 #ifndef MAXCDNAME 197 # define MAXCDNAME NS_MAXCDNAME 198 #endif 199 200 #ifndef MAXLABEL 201 # define MAXLABEL NS_MAXLABEL 202 #endif 203 204 #ifndef HFIXEDSZ 205 # define HFIXEDSZ NS_HFIXEDSZ 206 #endif 207 208 #ifndef QFIXEDSZ 209 # define QFIXEDSZ NS_QFIXEDSZ 210 #endif 211 212 #ifndef RRFIXEDSZ 213 # define RRFIXEDSZ NS_RRFIXEDSZ 214 #endif 215 216 #ifndef INDIR_MASK 217 # define INDIR_MASK NS_CMPRSFLGS 218 #endif 219 220 #ifndef NAMESERVER_PORT 221 # define NAMESERVER_PORT NS_DEFAULTPORT 222 #endif 223 224 225 /* opcodes */ 226 #ifndef O_QUERY 227 # define O_QUERY 0 /* ns_o_query */ 228 #endif 229 #ifndef O_IQUERY 230 # define O_IQUERY 1 /* ns_o_iquery */ 231 #endif 232 #ifndef O_STATUS 233 # define O_STATUS 2 /* ns_o_status */ 234 #endif 235 #ifndef O_NOTIFY 236 # define O_NOTIFY 4 /* ns_o_notify */ 237 #endif 238 #ifndef O_UPDATE 239 # define O_UPDATE 5 /* ns_o_update */ 240 #endif 241 242 243 /* response codes */ 244 #ifndef SERVFAIL 245 # define SERVFAIL ns_r_servfail 246 #endif 247 #ifndef NOTIMP 248 # define NOTIMP ns_r_notimpl 249 #endif 250 #ifndef REFUSED 251 # define REFUSED ns_r_refused 252 #endif 253 #if defined(_WIN32) && !defined(HAVE_ARPA_NAMESER_COMPAT_H) && defined(NOERROR) 254 # undef NOERROR /* it seems this is already defined in winerror.h */ 255 #endif 256 #ifndef NOERROR 257 # define NOERROR ns_r_noerror 258 #endif 259 #ifndef FORMERR 260 # define FORMERR ns_r_formerr 261 #endif 262 #ifndef NXDOMAIN 263 # define NXDOMAIN ns_r_nxdomain 264 #endif 265 /* Non-standard response codes, use numeric values */ 266 #ifndef YXDOMAIN 267 # define YXDOMAIN 6 /* ns_r_yxdomain */ 268 #endif 269 #ifndef YXRRSET 270 # define YXRRSET 7 /* ns_r_yxrrset */ 271 #endif 272 #ifndef NXRRSET 273 # define NXRRSET 8 /* ns_r_nxrrset */ 274 #endif 275 #ifndef NOTAUTH 276 # define NOTAUTH 9 /* ns_r_notauth */ 277 #endif 278 #ifndef NOTZONE 279 # define NOTZONE 10 /* ns_r_notzone */ 280 #endif 281 #ifndef TSIG_BADSIG 282 # define TSIG_BADSIG 16 /* ns_r_badsig */ 283 #endif 284 #ifndef TSIG_BADKEY 285 # define TSIG_BADKEY 17 /* ns_r_badkey */ 286 #endif 287 #ifndef TSIG_BADTIME 288 # define TSIG_BADTIME 18 /* ns_r_badtime */ 289 #endif 290 291 292 /* classes */ 293 #ifndef C_IN 294 # define C_IN 1 /* ns_c_in */ 295 #endif 296 #ifndef C_CHAOS 297 # define C_CHAOS 3 /* ns_c_chaos */ 298 #endif 299 #ifndef C_HS 300 # define C_HS 4 /* ns_c_hs */ 301 #endif 302 #ifndef C_NONE 303 # define C_NONE 254 /* ns_c_none */ 304 #endif 305 #ifndef C_ANY 306 # define C_ANY 255 /* ns_c_any */ 307 #endif 308 309 310 /* types */ 311 #ifndef T_A 312 # define T_A 1 /* ns_t_a */ 313 #endif 314 #ifndef T_NS 315 # define T_NS 2 /* ns_t_ns */ 316 #endif 317 #ifndef T_MD 318 # define T_MD 3 /* ns_t_md */ 319 #endif 320 #ifndef T_MF 321 # define T_MF 4 /* ns_t_mf */ 322 #endif 323 #ifndef T_CNAME 324 # define T_CNAME 5 /* ns_t_cname */ 325 #endif 326 #ifndef T_SOA 327 # define T_SOA 6 /* ns_t_soa */ 328 #endif 329 #ifndef T_MB 330 # define T_MB 7 /* ns_t_mb */ 331 #endif 332 #ifndef T_MG 333 # define T_MG 8 /* ns_t_mg */ 334 #endif 335 #ifndef T_MR 336 # define T_MR 9 /* ns_t_mr */ 337 #endif 338 #ifndef T_NULL 339 # define T_NULL 10 /* ns_t_null */ 340 #endif 341 #ifndef T_WKS 342 # define T_WKS 11 /* ns_t_wks */ 343 #endif 344 #ifndef T_PTR 345 # define T_PTR 12 /* ns_t_ptr */ 346 #endif 347 #ifndef T_HINFO 348 # define T_HINFO 13 /* ns_t_hinfo */ 349 #endif 350 #ifndef T_MINFO 351 # define T_MINFO 14 /* ns_t_minfo */ 352 #endif 353 #ifndef T_MX 354 # define T_MX 15 /* ns_t_mx */ 355 #endif 356 #ifndef T_TXT 357 # define T_TXT 16 /* ns_t_txt */ 358 #endif 359 #ifndef T_RP 360 # define T_RP 17 /* ns_t_rp */ 361 #endif 362 #ifndef T_AFSDB 363 # define T_AFSDB 18 /* ns_t_afsdb */ 364 #endif 365 #ifndef T_X25 366 # define T_X25 19 /* ns_t_x25 */ 367 #endif 368 #ifndef T_ISDN 369 # define T_ISDN 20 /* ns_t_isdn */ 370 #endif 371 #ifndef T_RT 372 # define T_RT 21 /* ns_t_rt */ 373 #endif 374 #ifndef T_NSAP 375 # define T_NSAP 22 /* ns_t_nsap */ 376 #endif 377 #ifndef T_NSAP_PTR 378 # define T_NSAP_PTR 23 /* ns_t_nsap_ptr */ 379 #endif 380 #ifndef T_SIG 381 # define T_SIG 24 /* ns_t_sig */ 382 #endif 383 #ifndef T_KEY 384 # define T_KEY 25 /* ns_t_key */ 385 #endif 386 #ifndef T_PX 387 # define T_PX 26 /* ns_t_px */ 388 #endif 389 #ifndef T_GPOS 390 # define T_GPOS 27 /* ns_t_gpos */ 391 #endif 392 #ifndef T_AAAA 393 # define T_AAAA 28 /* ns_t_aaaa */ 394 #endif 395 #ifndef T_LOC 396 # define T_LOC 29 /* ns_t_loc */ 397 #endif 398 #ifndef T_NXT 399 # define T_NXT 30 /* ns_t_nxt */ 400 #endif 401 #ifndef T_EID 402 # define T_EID 31 /* ns_t_eid */ 403 #endif 404 #ifndef T_NIMLOC 405 # define T_NIMLOC 32 /* ns_t_nimloc */ 406 #endif 407 #ifndef T_SRV 408 # define T_SRV 33 /* ns_t_srv */ 409 #endif 410 #ifndef T_ATMA 411 # define T_ATMA 34 /* ns_t_atma */ 412 #endif 413 #ifndef T_NAPTR 414 # define T_NAPTR 35 /* ns_t_naptr */ 415 #endif 416 #ifndef T_KX 417 # define T_KX 36 /* ns_t_kx */ 418 #endif 419 #ifndef T_CERT 420 # define T_CERT 37 /* ns_t_cert */ 421 #endif 422 #ifndef T_A6 423 # define T_A6 38 /* ns_t_a6 */ 424 #endif 425 #ifndef T_DNAME 426 # define T_DNAME 39 /* ns_t_dname */ 427 #endif 428 #ifndef T_SINK 429 # define T_SINK 40 /* ns_t_sink */ 430 #endif 431 #ifndef T_OPT 432 # define T_OPT 41 /* ns_t_opt */ 433 #endif 434 #ifndef T_APL 435 # define T_APL 42 /* ns_t_apl */ 436 #endif 437 #ifndef T_DS 438 # define T_DS 43 /* ns_t_ds */ 439 #endif 440 #ifndef T_SSHFP 441 # define T_SSHFP 44 /* ns_t_sshfp */ 442 #endif 443 #ifndef T_RRSIG 444 # define T_RRSIG 46 /* ns_t_rrsig */ 445 #endif 446 #ifndef T_NSEC 447 # define T_NSEC 47 /* ns_t_nsec */ 448 #endif 449 #ifndef T_DNSKEY 450 # define T_DNSKEY 48 /* ns_t_dnskey */ 451 #endif 452 #ifndef T_TKEY 453 # define T_TKEY 249 /* ns_t_tkey */ 454 #endif 455 #ifndef T_TSIG 456 # define T_TSIG 250 /* ns_t_tsig */ 457 #endif 458 #ifndef T_IXFR 459 # define T_IXFR 251 /* ns_t_ixfr */ 460 #endif 461 #ifndef T_AXFR 462 # define T_AXFR 252 /* ns_t_axfr */ 463 #endif 464 #ifndef T_MAILB 465 # define T_MAILB 253 /* ns_t_mailb */ 466 #endif 467 #ifndef T_MAILA 468 # define T_MAILA 254 /* ns_t_maila */ 469 #endif 470 #ifndef T_ANY 471 # define T_ANY 255 /* ns_t_any */ 472 #endif 473 #ifndef T_URI 474 # define T_URI 256 /* ns_t_uri */ 475 #endif 476 #ifndef T_CAA 477 # define T_CAA 257 /* ns_t_caa */ 478 #endif 479 #ifndef T_MAX 480 # define T_MAX 65536 /* ns_t_max */ 481 #endif 482 483 484 #endif /* ARES_NAMESER_H */ 485