chiark / gitweb /
resolved: Support resolved.conf.d directories in the usual search paths
[elogind.git] / src / resolve / resolved-dns-rr.h
index 61c00d59b26249db3f2758b50e1de197c18dc263..9d9a89d38343880f89cb872bb689ce1868d2cb76 100644 (file)
@@ -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,35 +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_LOC   = 0x1D,
-        DNS_TYPE_SRV   = 0x21,
-        DNS_TYPE_DNAME = 0x27,
-        DNS_TYPE_SSHFP = 0x2C,
-        DNS_TYPE_SPF   = 0x63,
-
-        /* 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;
@@ -144,6 +116,29 @@ struct DnsResourceRecord {
                         void *key;
                         size_t key_size;
                 } sshfp;
+
+                /* http://tools.ietf.org/html/rfc4034#section-2.1 */
+                struct {
+                        bool zone_key_flag:1;
+                        bool sep_flag:1;
+                        uint8_t algorithm;
+                        void* key;
+                        size_t key_size;
+                } dnskey;
+
+                /* http://tools.ietf.org/html/rfc4034#section-3.1 */
+                struct {
+                        uint16_t type_covered;
+                        uint8_t algorithm;
+                        uint8_t labels;
+                        uint32_t original_ttl;
+                        uint32_t expiration;
+                        uint32_t inception;
+                        uint16_t key_tag;
+                        char *signer;
+                        void *signature;
+                        size_t signature_size;
+                } rrsig;
         };
 };
 
@@ -164,8 +159,6 @@ DnsResourceKey* dns_resource_key_unref(DnsResourceKey *key);
 int dns_resource_key_equal(const DnsResourceKey *a, const DnsResourceKey *b);
 int dns_resource_key_match_rr(const DnsResourceKey *key, const DnsResourceRecord *rr);
 int dns_resource_key_match_cname(const DnsResourceKey *key, const DnsResourceRecord *rr);
-unsigned long dns_resource_key_hash_func(const void *i, const uint8_t hash_key[HASH_KEY_SIZE]);
-int dns_resource_key_compare_func(const void *a, const void *b);
 int dns_resource_key_to_string(const DnsResourceKey *key, char **ret);
 DEFINE_TRIVIAL_CLEANUP_FUNC(DnsResourceKey*, dns_resource_key_unref);
 
@@ -178,8 +171,7 @@ 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);
+
+extern const struct hash_ops dns_resource_key_hash_ops;