1<?php 2/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ 3 4/** 5 * DNS Library for handling lookups and updates. 6 * 7 * PHP Version 5 8 * 9 * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>. 10 * All rights reserved. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 16 * * Redistributions of source code must retain the above copyright 17 * notice, this list of conditions and the following disclaimer. 18 * 19 * * Redistributions in binary form must reproduce the above copyright 20 * notice, this list of conditions and the following disclaimer in 21 * the documentation and/or other materials provided with the 22 * distribution. 23 * 24 * * Neither the name of Mike Pultz nor the names of his contributors 25 * may be used to endorse or promote products derived from this 26 * software without specific prior written permission. 27 * 28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 31 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 32 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 33 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 34 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 35 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 36 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC 37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 38 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 39 * POSSIBILITY OF SUCH DAMAGE. 40 * 41 * @category Networking 42 * @package Net_DNS2 43 * @author Mike Pultz <mike@mikepultz.com> 44 * @copyright 2010 Mike Pultz <mike@mikepultz.com> 45 * @license http://www.opensource.org/licenses/bsd-license.php BSD License 46 * @version SVN: $Id$ 47 * @link http://pear.php.net/package/Net_DNS2 48 * @since File available since Release 0.6.0 49 * 50 */ 51 52// 53// initalize the packet id value 54// 55Net_DNS2_Lookups::$next_packet_id = mt_rand(0, 65535); 56 57// 58// build the reverse lookup tables; this is just so we don't have to 59// have duplicate static content laying around. 60// 61Net_DNS2_Lookups::$rr_types_by_id = array_flip(Net_DNS2_Lookups::$rr_types_by_name); 62Net_DNS2_Lookups::$classes_by_id = array_flip(Net_DNS2_Lookups::$classes_by_name); 63Net_DNS2_Lookups::$rr_types_class_to_id = array_flip(Net_DNS2_Lookups::$rr_types_id_to_class); 64Net_DNS2_Lookups::$algorithm_name_to_id = array_flip(Net_DNS2_Lookups::$algorithm_id_to_name); 65Net_DNS2_Lookups::$digest_name_to_id = array_flip(Net_DNS2_Lookups::$digest_id_to_name); 66Net_DNS2_Lookups::$rr_qtypes_by_id = array_flip(Net_DNS2_Lookups::$rr_qtypes_by_name); 67Net_DNS2_Lookups::$rr_metatypes_by_id = array_flip(Net_DNS2_Lookups::$rr_metatypes_by_name); 68Net_DNS2_Lookups::$protocol_by_id = array_flip(Net_DNS2_Lookups::$protocol_by_name); 69 70/** 71 * This class provides simple lookups used througout the Net_DNS2 code 72 * 73 * @category Networking 74 * @package Net_DNS2 75 * @author Mike Pultz <mike@mikepultz.com> 76 * @license http://www.opensource.org/licenses/bsd-license.php BSD License 77 * @link http://pear.php.net/package/Net_DNS2 78 * 79 */ 80class Net_DNS2_Lookups 81{ 82 /* 83 * size (in bytes) of a header in a standard DNS packet 84 */ 85 const DNS_HEADER_SIZE = 12; 86 87 /* 88 * max size of a UDP packet 89 */ 90 const DNS_MAX_UDP_SIZE = 512; 91 92 /* 93 * Query/Response flag 94 */ 95 const QR_QUERY = 0; // RFC 1035 96 const QR_RESPONSE = 1; // RFC 1035 97 98 /* 99 * DNS Op Codes 100 */ 101 const OPCODE_QUERY = 0; // RFC 1035 102 const OPCODE_IQUERY = 1; // RFC 1035, RFC 3425 103 const OPCODE_STATUS = 2; // RFC 1035 104 const OPCODE_NOTIFY = 4; // RFC 1996 105 const OPCODE_UPDATE = 5; // RFC 2136 106 107 /* 108 * Resource Record Classes 109 */ 110 const RR_CLASS_IN = 1; // RFC 1035 111 const RR_CLASS_CH = 3; // RFC 1035 112 const RR_CLASS_HS = 4; // RFC 1035 113 const RR_CLASS_NONE = 254; // RFC 2136 114 const RR_CLASS_ANY = 255; // RFC 1035 115 116 /* 117 * DNS Response Codes 118 */ 119 const RCODE_NOERROR = 0; // RFC 1035 120 const RCODE_FORMERR = 1; // RFC 1035 121 const RCODE_SERVFAIL = 2; // RFC 1035 122 const RCODE_NXDOMAIN = 3; // RFC 1035 123 const RCODE_NOTIMP = 4; // RFC 1035 124 const RCODE_REFUSED = 5; // RFC 1035 125 const RCODE_YXDOMAIN = 6; // RFC 2136 126 const RCODE_YXRRSET = 7; // RFC 2136 127 const RCODE_NXRRSET = 8; // RFC 2136 128 const RCODE_NOTAUTH = 9; // RFC 2136 129 const RCODE_NOTZONE = 10; // RFC 2136 130 131 // 11-15 reserved 132 133 const RCODE_BADSIG = 16; // RFC 2845 134 const RCODE_BADVERS = 16; // RFC 6891 135 const RCODE_BADKEY = 17; // RFC 2845 136 const RCODE_BADTIME = 18; // RFC 2845 137 const RCODE_BADMODE = 19; // RFC 2930 138 const RCODE_BADNAME = 20; // RFC 2930 139 const RCODE_BADALG = 21; // RFC 2930 140 const RCODE_BADTRUNC = 22; // RFC 4635 141 const RCODE_BADCOOKIE = 23; // RFC 7873 142 143 /* 144 * internal errors codes returned by the exceptions class 145 */ 146 const E_NONE = 0; 147 const E_DNS_FORMERR = self::RCODE_FORMERR; 148 const E_DNS_SERVFAIL = self::RCODE_SERVFAIL; 149 const E_DNS_NXDOMAIN = self::RCODE_NXDOMAIN; 150 const E_DNS_NOTIMP = self::RCODE_NOTIMP; 151 const E_DNS_REFUSED = self::RCODE_REFUSED; 152 const E_DNS_YXDOMAIN = self::RCODE_YXDOMAIN; 153 const E_DNS_YXRRSET = self::RCODE_YXRRSET; 154 const E_DNS_NXRRSET = self::RCODE_NXRRSET; 155 const E_DNS_NOTAUTH = self::RCODE_NOTAUTH; 156 const E_DNS_NOTZONE = self::RCODE_NOTZONE; 157 158 // 11-15 reserved 159 160 const E_DNS_BADSIG = self::RCODE_BADSIG; 161 const E_DNS_BADKEY = self::RCODE_BADKEY; 162 const E_DNS_BADTIME = self::RCODE_BADTIME; 163 const E_DNS_BADMODE = self::RCODE_BADMODE; 164 const E_DNS_BADNAME = self::RCODE_BADNAME; 165 const E_DNS_BADALG = self::RCODE_BADALG; 166 const E_DNS_BADTRUNC = self::RCODE_BADTRUNC; 167 const E_DNS_BADCOOKIE = self::RCODE_BADCOOKIE; 168 169 // other error conditions 170 171 const E_NS_INVALID_FILE = 200; 172 const E_NS_INVALID_ENTRY = 201; 173 const E_NS_FAILED = 202; 174 const E_NS_SOCKET_FAILED = 203; 175 const E_NS_INVALID_SOCKET = 204; 176 177 const E_PACKET_INVALID = 300; 178 const E_PARSE_ERROR = 301; 179 const E_HEADER_INVALID = 302; 180 const E_QUESTION_INVALID = 303; 181 const E_RR_INVALID = 304; 182 183 const E_OPENSSL_ERROR = 400; 184 const E_OPENSSL_UNAVAIL = 401; 185 const E_OPENSSL_INV_PKEY = 402; 186 const E_OPENSSL_INV_ALGO = 403; 187 188 const E_CACHE_UNSUPPORTED = 500; 189 const E_CACHE_SHM_FILE = 501; 190 const E_CACHE_SHM_UNAVAIL = 502; 191 192 /* 193 * EDNS0 Option Codes (OPT) 194 */ 195 // 0 - Reserved 196 const EDNS0_OPT_LLQ = 1; 197 const EDNS0_OPT_UL = 2; 198 const EDNS0_OPT_NSID = 3; 199 // 4 - Reserved 200 const EDNS0_OPT_DAU = 5; 201 const EDNS0_OPT_DHU = 6; 202 const EDNS0_OPT_N3U = 7; 203 const EDNS0_OPT_CLIENT_SUBNET = 8; 204 const EDNS0_OPT_EXPIRE = 9; 205 const EDNS0_OPT_COOKIE = 10; 206 const EDNS0_OPT_TCP_KEEPALIVE = 11; 207 const EDNS0_OPT_PADDING = 12; 208 const EDNS0_OPT_CHAIN = 13; 209 const EDNS0_OPT_KEY_TAG = 14; 210 211 /* 212 * DNSSEC Algorithms 213 */ 214 const DNSSEC_ALGORITHM_RES = 0; 215 const DNSSEC_ALGORITHM_RSAMD5 = 1; 216 const DNSSEC_ALGORITHM_DH = 2; 217 const DNSSEC_ALGORITHM_DSA = 3; 218 const DNSSEC_ALGORITHM_ECC = 4; 219 const DNSSEC_ALGORITHM_RSASHA1 = 5; 220 const DNSSEC_ALGORITHM_DSANSEC3SHA1 = 6; 221 const DSNSEC_ALGORITHM_RSASHA1NSEC3SHA1 = 7; 222 const DNSSEC_ALGORITHM_RSASHA256 = 8; 223 const DNSSEC_ALGORITHM_RSASHA512 = 10; 224 const DNSSEC_ALGORITHM_ECCGOST = 12; 225 const DNSSEC_ALGORITHM_ECDSAP256SHA256 = 13; 226 const DNSSEC_ALGORITHM_ECDSAP384SHA384 = 14; 227 const DNSSEC_ALGORITHM_ED25519 = 15; 228 const DNSSEC_ALGORITHM_ED448 = 16; 229 const DNSSEC_ALGORITHM_INDIRECT = 252; 230 const DNSSEC_ALGORITHM_PRIVATEDNS = 253; 231 const DNSSEC_ALGORITHM_PRIVATEOID = 254; 232 233 /* 234 * DNSSEC Digest Types 235 */ 236 const DNSSEC_DIGEST_RES = 0; 237 const DNSSEC_DIGEST_SHA1 = 1; 238 239 /* 240 * The packet id used when sending requests 241 */ 242 public static $next_packet_id; 243 244 /* 245 * Used to map resource record types to their id's, and back 246 */ 247 public static $rr_types_by_id = array(); 248 public static $rr_types_by_name = array( 249 250 'SIG0' => 0, // RFC 2931 pseudo type 251 'A' => 1, // RFC 1035 252 'NS' => 2, // RFC 1035 253 'MD' => 3, // RFC 1035 - obsolete, Not implemented 254 'MF' => 4, // RFC 1035 - obsolete, Not implemented 255 'CNAME' => 5, // RFC 1035 256 'SOA' => 6, // RFC 1035 257 'MB' => 7, // RFC 1035 - obsolete, Not implemented 258 'MG' => 8, // RFC 1035 - obsolete, Not implemented 259 'MR' => 9, // RFC 1035 - obsolete, Not implemented 260 'NULL' => 10, // RFC 1035 - obsolete, Not implemented 261 'WKS' => 11, // RFC 1035 262 'PTR' => 12, // RFC 1035 263 'HINFO' => 13, // RFC 1035 264 'MINFO' => 14, // RFC 1035 - obsolete, Not implemented 265 'MX' => 15, // RFC 1035 266 'TXT' => 16, // RFC 1035 267 'RP' => 17, // RFC 1183 268 'AFSDB' => 18, // RFC 1183 269 'X25' => 19, // RFC 1183 270 'ISDN' => 20, // RFC 1183 271 'RT' => 21, // RFC 1183 272 'NSAP' => 22, // RFC 1706 273 'NSAP_PTR' => 23, // RFC 1348 - obsolete, Not implemented 274 'SIG' => 24, // RFC 2535 275 'KEY' => 25, // RFC 2535, RFC 2930 276 'PX' => 26, // RFC 2163 277 'GPOS' => 27, // RFC 1712 - Not implemented 278 'AAAA' => 28, // RFC 3596 279 'LOC' => 29, // RFC 1876 280 'NXT' => 30, // RFC 2065, obsoleted by by RFC 3755 281 'EID' => 31, // [Patton][Patton1995] 282 'NIMLOC' => 32, // [Patton][Patton1995] 283 'SRV' => 33, // RFC 2782 284 'ATMA' => 34, // Windows only 285 'NAPTR' => 35, // RFC 2915 286 'KX' => 36, // RFC 2230 287 'CERT' => 37, // RFC 4398 288 'A6' => 38, // downgraded to experimental by RFC 3363 289 'DNAME' => 39, // RFC 2672 290 'SINK' => 40, // Not implemented 291 'OPT' => 41, // RFC 2671 292 'APL' => 42, // RFC 3123 293 'DS' => 43, // RFC 4034 294 'SSHFP' => 44, // RFC 4255 295 'IPSECKEY' => 45, // RFC 4025 296 'RRSIG' => 46, // RFC 4034 297 'NSEC' => 47, // RFC 4034 298 'DNSKEY' => 48, // RFC 4034 299 'DHCID' => 49, // RFC 4701 300 'NSEC3' => 50, // RFC 5155 301 'NSEC3PARAM' => 51, // RFC 5155 302 'TLSA' => 52, // RFC 6698 303 'SMIMEA' => 53, // draft-ietf-dane-smime-10 304 305 // 54 unassigned 306 307 'HIP' => 55, // RFC 5205 308 'NINFO' => 56, // Not implemented 309 'RKEY' => 57, // Not implemented 310 'TALINK' => 58, // 311 'CDS' => 59, // RFC 7344 312 'CDNSKEY' => 60, // RFC 7344 313 'OPENPGPKEY' => 61, // RFC 7929 314 'CSYNC' => 62, // RFC 7477 315 316 // 63 - 98 unassigned 317 318 'SPF' => 99, // RFC 4408 319 'UINFO' => 100, // no RFC, Not implemented 320 'UID' => 101, // no RFC, Not implemented 321 'GID' => 102, // no RFC, Not implemented 322 'UNSPEC' => 103, // no RFC, Not implemented 323 'NID' => 104, // RFC 6742 324 'L32' => 105, // RFC 6742 325 'L64' => 106, // RFC 6742 326 'LP' => 107, // RFC 6742 327 'EUI48' => 108, // RFC 7043 328 'EUI64' => 109, // RFC 7043 329 330 // 110 - 248 unassigned 331 332 'TKEY' => 249, // RFC 2930 333 'TSIG' => 250, // RFC 2845 334 'IXFR' => 251, // RFC 1995 - only a full (AXFR) is supported 335 'AXFR' => 252, // RFC 1035 336 'MAILB' => 253, // RFC 883, Not implemented 337 'MAILA' => 254, // RFC 973, Not implemented 338 'ANY' => 255, // RFC 1035 - we support both 'ANY' and '*' 339 'URI' => 256, // tools.ietf.org/html/draft-faltstrom-uri-06 340 'CAA' => 257, // tools.ietf.org/html/draft-ietf-pkix-caa-03 341 'AVC' => 258, // Application Visibility and Control 342 343 // 259 - 32767 unassigned 344 345 'TA' => 32768, // same as DS 346 'DLV' => 32769, // RFC 4431 347 'TYPE65534' => 65534 // Private Bind record 348 ); 349 350 /* 351 * Qtypes and Metatypes - defined in RFC2929 section 3.1 352 */ 353 public static $rr_qtypes_by_id = array(); 354 public static $rr_qtypes_by_name = array( 355 356 'IXFR' => 251, // RFC 1995 - only a full (AXFR) is supported 357 'AXFR' => 252, // RFC 1035 358 'MAILB' => 253, // RFC 883, Not implemented 359 'MAILA' => 254, // RFC 973, Not implemented 360 'ANY' => 255 // RFC 1035 - we support both 'ANY' and '*' 361 ); 362 363 public static $rr_metatypes_by_id = array(); 364 public static $rr_metatypes_by_name = array( 365 366 'OPT' => 41, // RFC 2671 367 'TKEY' => 249, // RFC 2930 368 'TSIG' => 250 // RFC 2845 369 ); 370 371 /* 372 * used to map resource record id's to RR class names 373 */ 374 public static $rr_types_class_to_id = array(); 375 public static $rr_types_id_to_class = array( 376 377 1 => 'Net_DNS2_RR_A', 378 2 => 'Net_DNS2_RR_NS', 379 5 => 'Net_DNS2_RR_CNAME', 380 6 => 'Net_DNS2_RR_SOA', 381 11 => 'Net_DNS2_RR_WKS', 382 12 => 'Net_DNS2_RR_PTR', 383 13 => 'Net_DNS2_RR_HINFO', 384 15 => 'Net_DNS2_RR_MX', 385 16 => 'Net_DNS2_RR_TXT', 386 17 => 'Net_DNS2_RR_RP', 387 18 => 'Net_DNS2_RR_AFSDB', 388 19 => 'Net_DNS2_RR_X25', 389 20 => 'Net_DNS2_RR_ISDN', 390 21 => 'Net_DNS2_RR_RT', 391 22 => 'Net_DNS2_RR_NSAP', 392 24 => 'Net_DNS2_RR_SIG', 393 25 => 'Net_DNS2_RR_KEY', 394 26 => 'Net_DNS2_RR_PX', 395 28 => 'Net_DNS2_RR_AAAA', 396 29 => 'Net_DNS2_RR_LOC', 397 31 => 'Net_DNS2_RR_EID', 398 32 => 'Net_DNS2_RR_NIMLOC', 399 33 => 'Net_DNS2_RR_SRV', 400 34 => 'Net_DNS2_RR_ATMA', 401 35 => 'Net_DNS2_RR_NAPTR', 402 36 => 'Net_DNS2_RR_KX', 403 37 => 'Net_DNS2_RR_CERT', 404 39 => 'Net_DNS2_RR_DNAME', 405 41 => 'Net_DNS2_RR_OPT', 406 42 => 'Net_DNS2_RR_APL', 407 43 => 'Net_DNS2_RR_DS', 408 44 => 'Net_DNS2_RR_SSHFP', 409 45 => 'Net_DNS2_RR_IPSECKEY', 410 46 => 'Net_DNS2_RR_RRSIG', 411 47 => 'Net_DNS2_RR_NSEC', 412 48 => 'Net_DNS2_RR_DNSKEY', 413 49 => 'Net_DNS2_RR_DHCID', 414 50 => 'Net_DNS2_RR_NSEC3', 415 51 => 'Net_DNS2_RR_NSEC3PARAM', 416 52 => 'Net_DNS2_RR_TLSA', 417 53 => 'Net_DNS2_RR_SMIMEA', 418 55 => 'Net_DNS2_RR_HIP', 419 58 => 'Net_DNS2_RR_TALINK', 420 59 => 'Net_DNS2_RR_CDS', 421 60 => 'Net_DNS2_RR_CDNSKEY', 422 61 => 'Net_DNS2_RR_OPENPGPKEY', 423 62 => 'Net_DNS2_RR_CSYNC', 424 99 => 'Net_DNS2_RR_SPF', 425 104 => 'Net_DNS2_RR_NID', 426 105 => 'Net_DNS2_RR_L32', 427 106 => 'Net_DNS2_RR_L64', 428 107 => 'Net_DNS2_RR_LP', 429 108 => 'Net_DNS2_RR_EUI48', 430 109 => 'Net_DNS2_RR_EUI64', 431 432 249 => 'Net_DNS2_RR_TKEY', 433 250 => 'Net_DNS2_RR_TSIG', 434 435 // 251 - IXFR - handled as a full zone transfer (252) 436 // 252 - AXFR - handled as a function call 437 438 255 => 'Net_DNS2_RR_ANY', 439 256 => 'Net_DNS2_RR_URI', 440 257 => 'Net_DNS2_RR_CAA', 441 258 => 'Net_DNS2_RR_AVC', 442 32768 => 'Net_DNS2_RR_TA', 443 32769 => 'Net_DNS2_RR_DLV', 444 65534 => 'Net_DNS2_RR_TYPE65534' 445 ); 446 447 /* 448 * used to map resource record class names to their id's, and back 449 */ 450 public static $classes_by_id = array(); 451 public static $classes_by_name = array( 452 453 'IN' => self::RR_CLASS_IN, // RFC 1035 454 'CH' => self::RR_CLASS_CH, // RFC 1035 455 'HS' => self::RR_CLASS_HS, // RFC 1035 456 'NONE' => self::RR_CLASS_NONE, // RFC 2136 457 'ANY' => self::RR_CLASS_ANY // RFC 1035 458 ); 459 460 /* 461 * maps response codes to error messages 462 */ 463 public static $result_code_messages = array( 464 465 self::RCODE_NOERROR => 'The request completed successfully.', 466 self::RCODE_FORMERR => 'The name server was unable to interpret the query.', 467 self::RCODE_SERVFAIL => 'The name server was unable to process this query due to a problem with the name server.', 468 self::RCODE_NXDOMAIN => 'The domain name referenced in the query does not exist.', 469 self::RCODE_NOTIMP => 'The name server does not support the requested kind of query.', 470 self::RCODE_REFUSED => 'The name server refuses to perform the specified operation for policy reasons.', 471 self::RCODE_YXDOMAIN => 'Name Exists when it should not.', 472 self::RCODE_YXRRSET => 'RR Set Exists when it should not.', 473 self::RCODE_NXRRSET => 'RR Set that should exist does not.', 474 self::RCODE_NOTAUTH => 'Server Not Authoritative for zone.', 475 self::RCODE_NOTZONE => 'Name not contained in zone.', 476 477 self::RCODE_BADSIG => 'TSIG Signature Failure.', 478 self::RCODE_BADKEY => 'Key not recognized.', 479 self::RCODE_BADTIME => 'Signature out of time window.', 480 self::RCODE_BADMODE => 'Bad TKEY Mode.', 481 self::RCODE_BADNAME => 'Duplicate key name.', 482 self::RCODE_BADALG => 'Algorithm not supported.', 483 self::RCODE_BADTRUNC => 'Bad truncation.' 484 ); 485 486 /* 487 * maps DNS SEC alrorithms to their mnemonics 488 */ 489 public static $algorithm_name_to_id = array(); 490 public static $algorithm_id_to_name = array( 491 492 self::DNSSEC_ALGORITHM_RES => 'RES', 493 self::DNSSEC_ALGORITHM_RSAMD5 => 'RSAMD5', 494 self::DNSSEC_ALGORITHM_DH => 'DH', 495 self::DNSSEC_ALGORITHM_DSA => 'DSA', 496 self::DNSSEC_ALGORITHM_ECC => 'ECC', 497 self::DNSSEC_ALGORITHM_RSASHA1 => 'RSASHA1', 498 self::DNSSEC_ALGORITHM_DSANSEC3SHA1 => 'DSA-NSEC3-SHA1', 499 self::DSNSEC_ALGORITHM_RSASHA1NSEC3SHA1 => 'RSASHA1-NSEC3-SHA1', 500 self::DNSSEC_ALGORITHM_RSASHA256 => 'RSASHA256', 501 self::DNSSEC_ALGORITHM_RSASHA512 => 'RSASHA512', 502 self::DNSSEC_ALGORITHM_ECCGOST => 'ECC-GOST', 503 self::DNSSEC_ALGORITHM_ECDSAP256SHA256 => 'ECDSAP256SHA256', 504 self::DNSSEC_ALGORITHM_ECDSAP384SHA384 => 'ECDSAP384SHA384', 505 self::DNSSEC_ALGORITHM_ED25519 => 'ED25519', 506 self::DNSSEC_ALGORITHM_ED448 => 'ED448', 507 self::DNSSEC_ALGORITHM_INDIRECT => 'INDIRECT', 508 self::DNSSEC_ALGORITHM_PRIVATEDNS => 'PRIVATEDNS', 509 self::DNSSEC_ALGORITHM_PRIVATEOID => 'PRIVATEOID' 510 ); 511 512 /* 513 * maps DNSSEC digest types to their mnemonics 514 */ 515 public static $digest_name_to_id = array(); 516 public static $digest_id_to_name = array( 517 518 self::DNSSEC_DIGEST_RES => 'RES', 519 self::DNSSEC_DIGEST_SHA1 => 'SHA-1' 520 ); 521 522 /* 523 * Protocols names - RFC 1010 524 */ 525 public static $protocol_by_id = array(); 526 public static $protocol_by_name = array( 527 528 'ICMP' => 1, 529 'IGMP' => 2, 530 'GGP' => 3, 531 'ST' => 5, 532 'TCP' => 6, 533 'UCL' => 7, 534 'EGP' => 8, 535 'IGP' => 9, 536 'BBN-RCC-MON' => 10, 537 'NVP-II' => 11, 538 'PUP' => 12, 539 'ARGUS' => 13, 540 'EMCON' => 14, 541 'XNET' => 15, 542 'CHAOS' => 16, 543 'UDP' => 17, 544 'MUX' => 18, 545 'DCN-MEAS' => 19, 546 'HMP' => 20, 547 'PRM' => 21, 548 'XNS-IDP' => 22, 549 'TRUNK-1' => 23, 550 'TRUNK-2' => 24, 551 'LEAF-1' => 25, 552 'LEAF-2' => 26, 553 'RDP' => 27, 554 'IRTP' => 28, 555 'ISO-TP4' => 29, 556 'NETBLT' => 30, 557 'MFE-NSP' => 31, 558 'MERIT-INP' => 32, 559 'SEP' => 33, 560 // 34 - 60 - Unassigned 561 // 61 - any host internal protocol 562 'CFTP' => 62, 563 // 63 - any local network 564 'SAT-EXPAK' => 64, 565 'MIT-SUBNET' => 65, 566 'RVD' => 66, 567 'IPPC' => 67, 568 // 68 - any distributed file system 569 'SAT-MON' => 69, 570 // 70 - Unassigned 571 'IPCV' => 71, 572 // 72 - 75 - Unassigned 573 'BR-SAT-MON' => 76, 574 // 77 - Unassigned 575 'WB-MON' => 78, 576 'WB-EXPAK' => 79 577 // 80 - 254 - Unassigned 578 // 255 - Reserved 579 ); 580} 581 582/* 583 * Local variables: 584 * tab-width: 4 585 * c-basic-offset: 4 586 * c-hanging-comment-ender-p: nil 587 * End: 588 */ 589?> 590