chiark / gitweb /
resolve: reject empty TXT records
[elogind.git] / src / resolve / resolved-dns-query.h
index 2756048be566caaaee0050e8bdb21d3445943889..13b3ee4f818187107c3ecb88c435d6862b6e6b4f 100644 (file)
 #include "set.h"
 
 typedef struct DnsQuery DnsQuery;
 #include "set.h"
 
 typedef struct DnsQuery DnsQuery;
-typedef struct DnsQueryTransaction DnsQueryTransaction;
 
 
-#include "resolved.h"
 #include "resolved-dns-scope.h"
 #include "resolved-dns-rr.h"
 #include "resolved-dns-scope.h"
 #include "resolved-dns-rr.h"
-#include "resolved-dns-packet.h"
 #include "resolved-dns-question.h"
 #include "resolved-dns-answer.h"
 #include "resolved-dns-question.h"
 #include "resolved-dns-answer.h"
-
-typedef enum DnsQueryState {
-        DNS_QUERY_NULL,
-        DNS_QUERY_PENDING,
-        DNS_QUERY_FAILURE,
-        DNS_QUERY_SUCCESS,
-        DNS_QUERY_NO_SERVERS,
-        DNS_QUERY_TIMEOUT,
-        DNS_QUERY_ATTEMPTS_MAX,
-        DNS_QUERY_INVALID_REPLY,
-        DNS_QUERY_RESOURCES,
-        DNS_QUERY_ABORTED,
-} DnsQueryState;
-
-struct DnsQueryTransaction {
-        DnsScope *scope;
-
-        DnsQuestion *question;
-
-        DnsQueryState state;
-        uint16_t id;
-
-        DnsPacket *sent, *received;
-        DnsAnswer *cached;
-
-        sd_event_source *timeout_event_source;
-        unsigned n_attempts;
-
-        /* TCP connection logic */
-        int tcp_fd;
-        sd_event_source *tcp_event_source;
-        size_t tcp_written, tcp_read;
-        be16_t tcp_read_size;
-
-        /* Queries this transaction is referenced by and that shall by
-         * notified about this specific transaction completing. */
-        Set *queries;
-
-        unsigned block_gc;
-
-        LIST_FIELDS(DnsQueryTransaction, transactions_by_scope);
-};
+#include "resolved-dns-stream.h"
+#include "resolved-dns-transaction.h"
+#include "resolved-manager.h"
 
 struct DnsQuery {
         Manager *manager;
         DnsQuestion *question;
 
 
 struct DnsQuery {
         Manager *manager;
         DnsQuestion *question;
 
-        DnsQueryState state;
+        uint64_t flags;
+        int ifindex;
+
+        DnsTransactionState state;
         unsigned n_cname_redirects;
 
         sd_event_source *timeout_event_source;
 
         /* Discovered data */
         unsigned n_cname_redirects;
 
         sd_event_source *timeout_event_source;
 
         /* Discovered data */
-        DnsPacket *received;
         DnsAnswer *answer;
         int answer_ifindex;
         DnsAnswer *answer;
         int answer_ifindex;
+        int answer_family;
+        DnsProtocol answer_protocol;
         int answer_rcode;
 
         /* Bus client information */
         int answer_rcode;
 
         /* Bus client information */
@@ -106,15 +68,12 @@ struct DnsQuery {
 
         Set *transactions;
 
 
         Set *transactions;
 
+        sd_bus_track *bus_track;
+
         LIST_FIELDS(DnsQuery, queries);
 };
 
         LIST_FIELDS(DnsQuery, queries);
 };
 
-DnsQueryTransaction* dns_query_transaction_free(DnsQueryTransaction *t);
-void dns_query_transaction_complete(DnsQueryTransaction *t, DnsQueryState state);
-
-void dns_query_transaction_process_reply(DnsQueryTransaction *t, DnsPacket *p);
-
-int dns_query_new(Manager *m, DnsQuery **q, DnsQuestion *question);
+int dns_query_new(Manager *m, DnsQuery **q, DnsQuestion *question, int family, uint64_t flags);
 DnsQuery *dns_query_free(DnsQuery *q);
 
 int dns_query_go(DnsQuery *q);
 DnsQuery *dns_query_free(DnsQuery *q);
 
 int dns_query_go(DnsQuery *q);
@@ -122,4 +81,6 @@ void dns_query_ready(DnsQuery *q);
 
 int dns_query_cname_redirect(DnsQuery *q, const char *name);
 
 
 int dns_query_cname_redirect(DnsQuery *q, const char *name);
 
+int dns_query_bus_track(DnsQuery *q, sd_bus *bus, sd_bus_message *m);
+
 DEFINE_TRIVIAL_CLEANUP_FUNC(DnsQuery*, dns_query_free);
 DEFINE_TRIVIAL_CLEANUP_FUNC(DnsQuery*, dns_query_free);