]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/resolve/resolved-dns-query.h
resolved: expose some properties on the bus
[thirdparty/systemd.git] / src / resolve / resolved-dns-query.h
CommitLineData
74b2466e
LP
1/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3#pragma once
4
5/***
6 This file is part of systemd.
7
8 Copyright 2014 Lennart Poettering
9
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.
14
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.
19
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/>.
22***/
23
74b2466e
LP
24
25#include "sd-bus.h"
71d35b6b 26
faa133f3 27#include "set.h"
74b2466e
LP
28
29typedef struct DnsQuery DnsQuery;
74b2466e 30
faa133f3 31#include "resolved-dns-answer.h"
71d35b6b 32#include "resolved-dns-question.h"
623a4c97 33#include "resolved-dns-stream.h"
74b2466e
LP
34
35struct DnsQuery {
36 Manager *manager;
45ec7efb
LP
37
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;
45 int auxiliary_result;
46
faa133f3 47 DnsQuestion *question;
74b2466e 48
51323288
LP
49 uint64_t flags;
50 int ifindex;
51
ec2c5e43 52 DnsTransactionState state;
faa133f3 53 unsigned n_cname_redirects;
74b2466e
LP
54
55 sd_event_source *timeout_event_source;
56
322345fd 57 /* Discovered data */
faa133f3 58 DnsAnswer *answer;
51323288
LP
59 int answer_family;
60 DnsProtocol answer_protocol;
faa133f3 61 int answer_rcode;
74b2466e 62
8ba9fd9c 63 /* Bus client information */
74b2466e 64 sd_bus_message *request;
0dd25fb9 65 int request_family;
45ec7efb 66 bool request_address_valid;
74b2466e 67 union in_addr_union request_address;
45ec7efb 68 unsigned block_all_complete;
74b2466e 69
322345fd 70 /* Completion callback */
74b2466e 71 void (*complete)(DnsQuery* q);
faa133f3
LP
72 unsigned block_ready;
73
74 Set *transactions;
74b2466e 75
82bd6ddd
LP
76 sd_bus_track *bus_track;
77
74b2466e 78 LIST_FIELDS(DnsQuery, queries);
45ec7efb 79 LIST_FIELDS(DnsQuery, auxiliary_queries);
74b2466e
LP
80};
81
51323288 82int dns_query_new(Manager *m, DnsQuery **q, DnsQuestion *question, int family, uint64_t flags);
74b2466e 83DnsQuery *dns_query_free(DnsQuery *q);
322345fd 84
45ec7efb
LP
85int dns_query_make_auxiliary(DnsQuery *q, DnsQuery *auxiliary_for);
86
322345fd 87int dns_query_go(DnsQuery *q);
faa133f3 88void dns_query_ready(DnsQuery *q);
74b2466e 89
45ec7efb 90int dns_query_process_cname(DnsQuery *q);
74b2466e 91
966c66e3 92int dns_query_bus_track(DnsQuery *q, sd_bus_message *m);
82bd6ddd 93
74b2466e 94DEFINE_TRIVIAL_CLEANUP_FUNC(DnsQuery*, dns_query_free);