1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
6 This file is part of systemd.
8 Copyright 2014 Lennart Poettering
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
25 #include <netinet/in.h>
30 typedef struct DnsResourceKey DnsResourceKey;
31 typedef struct DnsResourceRecord DnsResourceRecord;
33 /* DNS record classes, see RFC 1035 */
39 /* DNS record types, see RFC 1035 */
44 DNS_TYPE_CNAME = 0x05,
47 DNS_TYPE_HINFO = 0x0D,
52 DNS_TYPE_SSHFP = 0x2C,
53 DNS_TYPE_DNAME = 0x27,
57 DNS_TYPE_OPT = 0x29, /* EDNS0 option */
64 struct DnsResourceKey {
70 struct DnsResourceRecord {
83 /* uint16_t priority; */
84 /* uint16_t weight; */
103 struct in_addr in_addr;
107 struct in6_addr in6_addr;
112 void dns_resource_key_free(DnsResourceKey *key);
114 unsigned long dns_resource_key_hash_func(const void *i, const uint8_t hash_key[HASH_KEY_SIZE]);
115 int dns_resource_key_compare_func(const void *a, const void *b);
117 DnsResourceRecord* dns_resource_record_new(void);
118 DnsResourceRecord* dns_resource_record_ref(DnsResourceRecord *rr);
119 DnsResourceRecord* dns_resource_record_unref(DnsResourceRecord *rr);
121 DnsResourceRecord** dns_resource_record_freev(DnsResourceRecord **rrs, unsigned n);
123 int dns_resource_record_equal(const DnsResourceRecord *a, const DnsResourceRecord *b);
125 const char *dns_type_to_string(uint16_t type);
126 const char *dns_class_to_string(uint16_t type);
128 DEFINE_TRIVIAL_CLEANUP_FUNC(DnsResourceRecord*, dns_resource_record_unref);