]>
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 | ||
74b2466e LP |
24 | |
25 | #include "sd-bus.h" | |
faa133f3 | 26 | #include "set.h" |
74b2466e LP |
27 | |
28 | typedef struct DnsQuery DnsQuery; | |
74b2466e | 29 | |
faa133f3 LP |
30 | #include "resolved-dns-question.h" |
31 | #include "resolved-dns-answer.h" | |
623a4c97 | 32 | #include "resolved-dns-stream.h" |
74b2466e LP |
33 | |
34 | struct DnsQuery { | |
35 | Manager *manager; | |
faa133f3 | 36 | DnsQuestion *question; |
74b2466e | 37 | |
51323288 LP |
38 | uint64_t flags; |
39 | int ifindex; | |
40 | ||
ec2c5e43 | 41 | DnsTransactionState state; |
faa133f3 | 42 | unsigned n_cname_redirects; |
74b2466e LP |
43 | |
44 | sd_event_source *timeout_event_source; | |
45 | ||
322345fd | 46 | /* Discovered data */ |
faa133f3 | 47 | DnsAnswer *answer; |
51323288 LP |
48 | int answer_family; |
49 | DnsProtocol answer_protocol; | |
faa133f3 | 50 | int answer_rcode; |
74b2466e | 51 | |
8ba9fd9c | 52 | /* Bus client information */ |
74b2466e | 53 | sd_bus_message *request; |
0dd25fb9 | 54 | int request_family; |
74b2466e LP |
55 | const char *request_hostname; |
56 | union in_addr_union request_address; | |
57 | ||
322345fd | 58 | /* Completion callback */ |
74b2466e | 59 | void (*complete)(DnsQuery* q); |
faa133f3 LP |
60 | unsigned block_ready; |
61 | ||
62 | Set *transactions; | |
74b2466e | 63 | |
82bd6ddd LP |
64 | sd_bus_track *bus_track; |
65 | ||
74b2466e LP |
66 | LIST_FIELDS(DnsQuery, queries); |
67 | }; | |
68 | ||
51323288 | 69 | int dns_query_new(Manager *m, DnsQuery **q, DnsQuestion *question, int family, uint64_t flags); |
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 | 76 | |
966c66e3 | 77 | int dns_query_bus_track(DnsQuery *q, sd_bus_message *m); |
82bd6ddd | 78 | |
74b2466e | 79 | DEFINE_TRIVIAL_CLEANUP_FUNC(DnsQuery*, dns_query_free); |