summaryrefslogtreecommitdiff
path: root/src/resolve/resolved-dns-rr.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-07-22 21:48:41 +0200
committerLennart Poettering <lennart@poettering.net>2014-07-23 02:00:40 +0200
commitfaa133f3aa7a18f26563dc5d6b95898cb315c37a (patch)
tree17b1a2aaba6b5a8e04e1fa361d5e9324ea249589 /src/resolve/resolved-dns-rr.h
parenta3eca41994de42f5448b35e8815d3009b2b5df38 (diff)
resolved: rework logic so that we can share transactions between queries of different clients
Diffstat (limited to 'src/resolve/resolved-dns-rr.h')
-rw-r--r--src/resolve/resolved-dns-rr.h36
1 files changed, 23 insertions, 13 deletions
diff --git a/src/resolve/resolved-dns-rr.h b/src/resolve/resolved-dns-rr.h
index 5d9f3e5a24..3ab01fac8d 100644
--- a/src/resolve/resolved-dns-rr.h
+++ b/src/resolve/resolved-dns-rr.h
@@ -62,17 +62,15 @@ enum {
};
struct DnsResourceKey {
- uint16_t class;
- uint16_t type;
- char *name;
+ unsigned n_ref;
+ uint16_t class, type;
+ char *_name; /* don't access directy, use DNS_RESOURCE_KEY_NAME()! */
};
struct DnsResourceRecord {
unsigned n_ref;
-
- DnsResourceKey key;
+ DnsResourceKey *key;
uint32_t ttl;
-
union {
struct {
void *data;
@@ -109,20 +107,32 @@ struct DnsResourceRecord {
};
};
-void dns_resource_key_free(DnsResourceKey *key);
+static inline const char* DNS_RESOURCE_KEY_NAME(const DnsResourceKey *key) {
+ if (_unlikely_(!key))
+ return NULL;
+
+ if (key->_name)
+ return key->_name;
+
+ return (char*) key + sizeof(DnsResourceKey);
+}
+DnsResourceKey* dns_resource_key_new(uint16_t class, uint16_t type, const char *name);
+DnsResourceKey* dns_resource_key_new_consume(uint16_t class, uint16_t type, char *name);
+DnsResourceKey* dns_resource_key_ref(DnsResourceKey *key);
+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);
+DEFINE_TRIVIAL_CLEANUP_FUNC(DnsResourceKey*, dns_resource_key_unref);
-DnsResourceRecord* dns_resource_record_new(void);
+DnsResourceRecord* dns_resource_record_new(DnsResourceKey *key);
DnsResourceRecord* dns_resource_record_ref(DnsResourceRecord *rr);
DnsResourceRecord* dns_resource_record_unref(DnsResourceRecord *rr);
-
-DnsResourceRecord** dns_resource_record_freev(DnsResourceRecord **rrs, unsigned n);
-
int dns_resource_record_equal(const DnsResourceRecord *a, const DnsResourceRecord *b);
+DEFINE_TRIVIAL_CLEANUP_FUNC(DnsResourceRecord*, dns_resource_record_unref);
const char *dns_type_to_string(uint16_t type);
const char *dns_class_to_string(uint16_t type);
-
-DEFINE_TRIVIAL_CLEANUP_FUNC(DnsResourceRecord*, dns_resource_record_unref);