X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fresolve%2Fresolved-dns-rr.h;h=20a344b8ca53c615ae832c56d3a52a2862d01bc3;hb=7263f72499e962b3fd54cdb7c79d49ca72121ede;hp=7b73cdc6cae1fabe5501be26777c0b911431a911;hpb=b93312f5960b276bae915906ccde36f545bae3e0;p=elogind.git diff --git a/src/resolve/resolved-dns-rr.h b/src/resolve/resolved-dns-rr.h index 7b73cdc6c..20a344b8c 100644 --- a/src/resolve/resolved-dns-rr.h +++ b/src/resolve/resolved-dns-rr.h @@ -27,6 +27,7 @@ #include "util.h" #include "hashmap.h" #include "in-addr-util.h" +#include "dns-type.h" typedef struct DnsResourceKey DnsResourceKey; typedef struct DnsResourceRecord DnsResourceRecord; @@ -39,33 +40,6 @@ enum { _DNS_CLASS_INVALID = -1 }; -/* 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_DNAME = 0x27, - DNS_TYPE_SSHFP = 0x2C, - - /* Special records */ - DNS_TYPE_ANY = 0xFF, - DNS_TYPE_OPT = 0x29, /* EDNS0 option */ - DNS_TYPE_TKEY = 0xF9, - DNS_TYPE_TSIG = 0xFA, - DNS_TYPE_IXFR = 0xFB, - DNS_TYPE_AXFR = 0xFC, - _DNS_TYPE_MAX, - _DNS_TYPE_INVALID = -1 -}; - struct DnsResourceKey { unsigned n_ref; uint16_t class, type; @@ -76,31 +50,32 @@ struct DnsResourceRecord { unsigned n_ref; DnsResourceKey *key; uint32_t ttl; + bool unparseable; union { struct { void *data; uint16_t size; } generic; - /* struct { */ - /* uint16_t priority; */ - /* uint16_t weight; */ - /* uint16_t port; */ - /* char *name; */ - /* } srv; */ + struct { + uint16_t priority; + uint16_t weight; + uint16_t port; + char *name; + } srv; struct { char *name; - } ptr, ns, cname; + } ptr, ns, cname, dname; struct { char *cpu; char *os; } hinfo; - /* struct { */ - /* char **list; */ - /* } txt; */ + struct { + char **strings; + } txt, spf; struct { struct in_addr in_addr; @@ -119,6 +94,28 @@ struct DnsResourceRecord { uint32_t expire; uint32_t minimum; } soa; + + struct { + uint16_t priority; + char *exchange; + } mx; + + struct { + uint8_t version; + uint8_t size; + uint8_t horiz_pre; + uint8_t vert_pre; + uint32_t latitude; + uint32_t longitude; + uint32_t altitude; + } loc; + + struct { + uint8_t algorithm; + uint8_t fptype; + void *key; + size_t key_size; + } sshfp; }; }; @@ -153,8 +150,5 @@ int dns_resource_record_equal(const DnsResourceRecord *a, const DnsResourceRecor int dns_resource_record_to_string(const DnsResourceRecord *rr, char **ret); DEFINE_TRIVIAL_CLEANUP_FUNC(DnsResourceRecord*, dns_resource_record_unref); -const char *dns_type_to_string(uint16_t type); -int dns_type_from_string(const char *name, uint16_t *type); - const char *dns_class_to_string(uint16_t type); int dns_class_from_string(const char *name, uint16_t *class);