]>
Commit | Line | Data |
---|---|---|
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 | ||
24 | #include <inttypes.h> | |
25 | ||
26 | #include "sd-bus.h" | |
27 | #include "util.h" | |
faa133f3 | 28 | #include "set.h" |
74b2466e LP |
29 | |
30 | typedef struct DnsQuery DnsQuery; | |
74b2466e LP |
31 | |
32 | #include "resolved.h" | |
33 | #include "resolved-dns-scope.h" | |
34 | #include "resolved-dns-rr.h" | |
faa133f3 LP |
35 | #include "resolved-dns-question.h" |
36 | #include "resolved-dns-answer.h" | |
623a4c97 | 37 | #include "resolved-dns-stream.h" |
ec2c5e43 | 38 | #include "resolved-dns-transaction.h" |
74b2466e LP |
39 | |
40 | struct DnsQuery { | |
41 | Manager *manager; | |
faa133f3 | 42 | DnsQuestion *question; |
74b2466e | 43 | |
ec2c5e43 | 44 | DnsTransactionState state; |
faa133f3 | 45 | unsigned n_cname_redirects; |
74b2466e LP |
46 | |
47 | sd_event_source *timeout_event_source; | |
48 | ||
322345fd | 49 | /* Discovered data */ |
faa133f3 LP |
50 | DnsAnswer *answer; |
51 | int answer_ifindex; | |
52 | int answer_rcode; | |
74b2466e | 53 | |
8ba9fd9c | 54 | /* Bus client information */ |
74b2466e | 55 | sd_bus_message *request; |
0dd25fb9 | 56 | int request_family; |
74b2466e LP |
57 | const char *request_hostname; |
58 | union in_addr_union request_address; | |
59 | ||
322345fd | 60 | /* Completion callback */ |
74b2466e | 61 | void (*complete)(DnsQuery* q); |
faa133f3 LP |
62 | unsigned block_ready; |
63 | ||
64 | Set *transactions; | |
74b2466e | 65 | |
74b2466e LP |
66 | LIST_FIELDS(DnsQuery, queries); |
67 | }; | |
68 | ||
faa133f3 | 69 | int dns_query_new(Manager *m, DnsQuery **q, DnsQuestion *question); |
74b2466e | 70 | DnsQuery *dns_query_free(DnsQuery *q); |
322345fd LP |
71 | |
72 | int dns_query_go(DnsQuery *q); | |
faa133f3 | 73 | void dns_query_ready(DnsQuery *q); |
74b2466e | 74 | |
faa133f3 | 75 | int dns_query_cname_redirect(DnsQuery *q, const char *name); |
74b2466e LP |
76 | |
77 | DEFINE_TRIVIAL_CLEANUP_FUNC(DnsQuery*, dns_query_free); |