dns-type.c revision d0129ddb9fbb07bed7c8ea51b8031f824bf506fb
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani This file is part of systemd.
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani Copyright 2014 Zbigniew Jędrzejewski-Szmek
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani systemd is free software; you can redistribute it and/or modify it
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani under the terms of the GNU Lesser General Public License as published by
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani the Free Software Foundation; either version 2.1 of the License, or
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani (at your option) any later version.
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani systemd is distributed in the hope that it will be useful, but
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani WITHOUT ANY WARRANTY; without even the implied warranty of
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani Lesser General Public License for more details.
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani You should have received a copy of the GNU Lesser General Public License
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani along with systemd; If not, see <http://www.gnu.org/licenses/>.
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahanitypedef const struct {
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahanistatic const struct dns_type_name *
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahanilookup_dns_type (register const char *str, register unsigned int len);
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahaniint dns_type_from_string(const char *s) {
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani /* Checks whether the specified type is a "pseudo-type". What
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani * a "pseudo-type" precisely is, is defined only very weakly,
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani * but apparently entails all RR types that are not actually
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani * stored as RRs on the server and should hence also not be
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani * cached. We use this list primarily to validate NSEC type
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani * bitfields, and to verify what to cache. */
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani 0, /* A Pseudo RR type, according to RFC 2931 */
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani /* The types valid as questions in packets */
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani /* The types valid as RR in packets (but not necessarily
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani * stored on servers). */
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani /* The following record types should never be redirected using
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani * <https://tools.ietf.org/html/rfc4035#section-2.5>. */
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani return false;
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani /* Obsoleted by RFC 973 */
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani /* Kinda obsoleted by RFC 2505 */
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani /* RFC1127 kinda obsoleted this by recommending against its use */
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani /* Declared historical by RFC 6563 */
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani /* Obsoleted by DNSSEC-bis */
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani /* RFC 1035 removed support for concepts that needed this from RFC 883 */
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahaniconst char *dns_class_to_string(uint16_t class) {
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani return "ANY";
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahaniint dns_class_from_string(const char *s) {