resolved-dns-rr.c revision 2e276efc7b0398a3086629a52970bdd4ab7252f9
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani This file is part of systemd.
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani Copyright 2014 Lennart Poettering
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 SahaniDnsResourceKey* dns_resource_key_new(uint16_t class, uint16_t type, const char *name) {
6b3fd9a14d378a35d95ec4be65065708d092bee2Torstein Husebø k = malloc0(sizeof(DnsResourceKey) + l + 1);
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani strcpy((char*) k + sizeof(DnsResourceKey), name);
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant SahaniDnsResourceKey* dns_resource_key_new_consume(uint16_t class, uint16_t type, char *name) {
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant SahaniDnsResourceKey* dns_resource_key_ref(DnsResourceKey *k) {
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant SahaniDnsResourceKey* dns_resource_key_unref(DnsResourceKey *k) {
7a6f1457462840ed52f2a332e2bd56ca210cff2dTom Gundersenint dns_resource_key_equal(const DnsResourceKey *a, const DnsResourceKey *b) {
const DnsResourceKey *k = i;
unsigned long ul;
return ul;
int dns_resource_key_compare_func(const void *a, const void *b) {
const DnsResourceKey *x = a, *y = b;
int ret;
if (ret != 0)
return ret;
c = cbuf;
t = tbuf;
return -ENOMEM;
*ret = s;
if (!rr)
return NULL;
return rr;
if (!key)
return NULL;
if (!rr)
return NULL;
return rr;
if (!rr)
return NULL;
return NULL;
return NULL;
int dns_resource_record_new_reverse(DnsResourceRecord **ret, int family, const union in_addr_union *address, const char *hostname) {
if (!key)
return -ENOMEM;
if (!rr)
return -ENOMEM;
return -ENOMEM;
assert(a);
assert(b);
case DNS_TYPE_PTR:
case DNS_TYPE_NS:
case DNS_TYPE_CNAME:
case DNS_TYPE_HINFO:
case DNS_TYPE_TXT: {
case DNS_TYPE_A:
case DNS_TYPE_AAAA:
case DNS_TYPE_SOA:
case DNS_TYPE_MX:
case DNS_TYPE_PTR:
case DNS_TYPE_NS:
case DNS_TYPE_CNAME:
return -ENOMEM;
case DNS_TYPE_HINFO:
return -ENOMEM;
case DNS_TYPE_TXT: {
_cleanup_free_ char *t;
return -ENOMEM;
return -ENOMEM;
case DNS_TYPE_A: {
return -ENOMEM;
case DNS_TYPE_AAAA: {
return -ENOMEM;
case DNS_TYPE_SOA:
return -ENOMEM;
case DNS_TYPE_MX:
return -ENOMEM;
return -ENOMEM;
return -ENOMEM;
*ret = s;
switch (class) {
case DNS_CLASS_IN:
case DNS_CLASS_ANY:
return NULL;
assert(s);
return -EINVAL;
const char *name;
} dns_types[] = {
return NULL;
assert(s);
return -EINVAL;