resolved-dns-rr.h revision 7e8e0422aeb16f2a09a40546c61df753d10029b6
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
#pragma once
/***
This file is part of systemd.
Copyright 2014 Lennart Poettering
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/>.
***/
#include <inttypes.h>
#include "util.h"
#include "hashmap.h"
typedef struct DnsResourceKey DnsResourceKey;
typedef struct DnsResourceRecord DnsResourceRecord;
/* DNS record classes, see RFC 1035 */
enum {
DNS_CLASS_IN = 0x01,
DNS_CLASS_ANY = 0xFF,
};
/* DNS record types, see RFC 1035 */
enum {
/* Normal records */
DNS_TYPE_A = 0x01,
DNS_TYPE_NS = 0x02,
DNS_TYPE_CNAME = 0x05,
DNS_TYPE_SOA = 0x06,
DNS_TYPE_PTR = 0x0C,
DNS_TYPE_HINFO = 0x0D,
DNS_TYPE_MX = 0x0F,
DNS_TYPE_TXT = 0x10,
DNS_TYPE_AAAA = 0x1C,
DNS_TYPE_SRV = 0x21,
DNS_TYPE_SSHFP = 0x2C,
DNS_TYPE_DNAME = 0x27,
/* Special records */
DNS_TYPE_ANY = 0xFF,
DNS_TYPE_TKEY = 0xF9,
DNS_TYPE_TSIG = 0xFA,
DNS_TYPE_IXFR = 0xFB,
DNS_TYPE_AXFR = 0xFC,
};
struct DnsResourceKey {
unsigned n_ref;
char *_name; /* don't access directy, use DNS_RESOURCE_KEY_NAME()! */
};
struct DnsResourceRecord {
unsigned n_ref;
union {
struct {
void *data;
} generic;
/* struct { */
/* uint16_t priority; */
/* uint16_t weight; */
/* uint16_t port; */
/* char *name; */
/* } srv; */
struct {
char *name;
struct {
char *cpu;
char *os;
} hinfo;
/* struct { */
/* char **list; */
/* } txt; */
struct {
} a;
struct {
} aaaa;
struct {
char *mname;
char *rname;
} soa;
};
};
if (_unlikely_(!key))
return NULL;
return (char*) key + sizeof(DnsResourceKey);
}
int dns_resource_key_compare_func(const void *a, const void *b);