chiark / gitweb /
resolved: properly process DNAME RRs
[elogind.git] / src / resolve / resolved-dns-rr.h
index 50bb74c..027f6ca 100644 (file)
@@ -35,6 +35,8 @@ typedef struct DnsResourceRecord DnsResourceRecord;
 enum {
         DNS_CLASS_IN   = 0x01,
         DNS_CLASS_ANY  = 0xFF,
+        _DNS_CLASS_MAX,
+        _DNS_CLASS_INVALID = -1
 };
 
 /* DNS record types, see RFC 1035 */
@@ -49,10 +51,13 @@ enum {
         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 */
@@ -60,6 +65,8 @@ enum {
         DNS_TYPE_TSIG  = 0xFA,
         DNS_TYPE_IXFR  = 0xFB,
         DNS_TYPE_AXFR  = 0xFC,
+        _DNS_TYPE_MAX,
+        _DNS_TYPE_INVALID = -1
 };
 
 struct DnsResourceKey {
@@ -72,6 +79,7 @@ struct DnsResourceRecord {
         unsigned n_ref;
         DnsResourceKey *key;
         uint32_t ttl;
+        bool unparseable;
         union {
                 struct {
                         void *data;
@@ -87,16 +95,16 @@ struct DnsResourceRecord {
 
                 struct {
                         char *name;
-                } ptr, ns, cname;
+                } ptr, ns, cname, dname;
 
                 struct {
                         char *cpu;
                         char *os;
                 } hinfo;
 
-                /* struct { */
-                /*         char **list; */
-                /* } txt; */
+                struct {
+                        char **strings;
+                } txt;
 
                 struct {
                         struct in_addr in_addr;
@@ -115,6 +123,21 @@ 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;
         };
 };
 
@@ -137,6 +160,7 @@ int dns_resource_key_match_rr(const DnsResourceKey *key, const DnsResourceRecord
 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);
 
 DnsResourceRecord* dns_resource_record_new(DnsResourceKey *key);
@@ -145,7 +169,11 @@ DnsResourceRecord* dns_resource_record_ref(DnsResourceRecord *rr);
 DnsResourceRecord* dns_resource_record_unref(DnsResourceRecord *rr);
 int dns_resource_record_new_reverse(DnsResourceRecord **ret, int family, const union in_addr_union *address, const char *name);
 int dns_resource_record_equal(const DnsResourceRecord *a, const DnsResourceRecord *b);
+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);