1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
6 This file is part of systemd.
8 Copyright 2014 Lennart Poettering
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
29 typedef struct DnsQuery DnsQuery
;
31 #include "resolved-dns-answer.h"
32 #include "resolved-dns-question.h"
33 #include "resolved-dns-stream.h"
38 /* When resolving a service, we first create a TXT+SRV query,
39 * and then for the hostnames we discover auxiliary A+AAAA
40 * queries. This pointer always points from the auxiliary
41 * queries back to the TXT+SRV query. */
42 DnsQuery
*auxiliary_for
;
43 LIST_HEAD(DnsQuery
, auxiliary_queries
);
44 unsigned n_auxiliary_queries
;
47 DnsQuestion
*question
;
52 DnsTransactionState state
;
53 unsigned n_cname_redirects
;
55 sd_event_source
*timeout_event_source
;
60 DnsProtocol answer_protocol
;
63 /* Bus client information */
64 sd_bus_message
*request
;
66 bool request_address_valid
;
67 union in_addr_union request_address
;
68 unsigned block_all_complete
;
70 /* Completion callback */
71 void (*complete
)(DnsQuery
* q
);
76 sd_bus_track
*bus_track
;
78 LIST_FIELDS(DnsQuery
, queries
);
79 LIST_FIELDS(DnsQuery
, auxiliary_queries
);
82 int dns_query_new(Manager
*m
, DnsQuery
**q
, DnsQuestion
*question
, int family
, uint64_t flags
);
83 DnsQuery
*dns_query_free(DnsQuery
*q
);
85 int dns_query_make_auxiliary(DnsQuery
*q
, DnsQuery
*auxiliary_for
);
87 int dns_query_go(DnsQuery
*q
);
88 void dns_query_ready(DnsQuery
*q
);
90 int dns_query_process_cname(DnsQuery
*q
);
92 int dns_query_bus_track(DnsQuery
*q
, sd_bus_message
*m
);
94 DEFINE_TRIVIAL_CLEANUP_FUNC(DnsQuery
*, dns_query_free
);