Systemd/src/resolve/dns-type.h
Lennart Poettering c463eb783e resolved: generalize DNS RR type validity checks
Check the validity of RR types as we parse or receive data from IPC
clients, and use the same code for all of them.
2015-12-11 14:14:27 +01:00

125 lines
3.1 KiB
C

/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2014 Zbigniew Jędrzejewski-Szmek
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#pragma once
#include "macro.h"
const char *dns_type_to_string(int type);
int dns_type_from_string(const char *s);
bool dns_type_is_pseudo(uint16_t type);
bool dns_type_is_valid_query(uint16_t type);
bool dns_type_is_valid_rr(uint16_t type);
/* DNS record types, taken from
* http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml.
*/
enum {
/* Normal records */
DNS_TYPE_A = 0x01,
DNS_TYPE_NS,
DNS_TYPE_MD,
DNS_TYPE_MF,
DNS_TYPE_CNAME,
DNS_TYPE_SOA,
DNS_TYPE_MB,
DNS_TYPE_MG,
DNS_TYPE_MR,
DNS_TYPE_NULL,
DNS_TYPE_WKS,
DNS_TYPE_PTR,
DNS_TYPE_HINFO,
DNS_TYPE_MINFO,
DNS_TYPE_MX,
DNS_TYPE_TXT,
DNS_TYPE_RP,
DNS_TYPE_AFSDB,
DNS_TYPE_X25,
DNS_TYPE_ISDN,
DNS_TYPE_RT,
DNS_TYPE_NSAP,
DNS_TYPE_NSAP_PTR,
DNS_TYPE_SIG,
DNS_TYPE_KEY,
DNS_TYPE_PX,
DNS_TYPE_GPOS,
DNS_TYPE_AAAA,
DNS_TYPE_LOC,
DNS_TYPE_NX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