summaryrefslogtreecommitdiff
path: root/src/resolve/resolved-dns-question.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/resolve/resolved-dns-question.h')
-rw-r--r--src/resolve/resolved-dns-question.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/resolve/resolved-dns-question.h b/src/resolve/resolved-dns-question.h
index 9894ef6ec5..e77116c03a 100644
--- a/src/resolve/resolved-dns-question.h
+++ b/src/resolve/resolved-dns-question.h
@@ -25,7 +25,7 @@ typedef struct DnsQuestion DnsQuestion;
#include "resolved-dns-rr.h"
-/* A simple array of resources keys, all sharing the same domain */
+/* A simple array of resources keys */
struct DnsQuestion {
unsigned n_ref;
@@ -43,14 +43,22 @@ int dns_question_new_service(DnsQuestion **ret, const char *name, bool with_txt)
int dns_question_add(DnsQuestion *q, DnsResourceKey *key);
-int dns_question_matches_rr(DnsQuestion *q, DnsResourceRecord *rr);
-int dns_question_matches_cname(DnsQuestion *q, DnsResourceRecord *rr);
-int dns_question_is_valid(DnsQuestion *q);
+int dns_question_matches_rr(DnsQuestion *q, DnsResourceRecord *rr, const char *search_domain);
+int dns_question_matches_cname(DnsQuestion *q, DnsResourceRecord *rr, const char* search_domain);
+int dns_question_is_valid_for_query(DnsQuestion *q);
int dns_question_contains(DnsQuestion *a, DnsResourceKey *k);
int dns_question_is_equal(DnsQuestion *a, DnsQuestion *b);
int dns_question_cname_redirect(DnsQuestion *q, const DnsResourceRecord *cname, DnsQuestion **ret);
-const char *dns_question_name(DnsQuestion *q);
+const char *dns_question_first_name(DnsQuestion *q);
DEFINE_TRIVIAL_CLEANUP_FUNC(DnsQuestion*, dns_question_unref);
+
+#define DNS_QUESTION_FOREACH(key, q) \
+ for (unsigned _i = ({ \
+ (key) = ((q) && (q)->n_keys > 0) ? (q)->keys[0] : NULL; \
+ 0; \
+ }); \
+ (q) && ((_i) < (q)->n_keys); \
+ _i++, (key) = (_i < (q)->n_keys ? (q)->keys[_i] : NULL))