]>
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 | ||
3c0cf502 LP |
24 | #include "in-addr-util.h" |
25 | ||
74b2466e LP |
26 | typedef struct DnsServer DnsServer; |
27 | typedef enum DnsServerSource DnsServerSource; | |
28 | ||
4e945a6f LP |
29 | typedef enum DnsServerType { |
30 | DNS_SERVER_SYSTEM, | |
31 | DNS_SERVER_FALLBACK, | |
32 | DNS_SERVER_LINK, | |
33 | } DnsServerType; | |
34 | ||
3e684349 LP |
35 | #include "resolved-link.h" |
36 | ||
74b2466e LP |
37 | struct DnsServer { |
38 | Manager *manager; | |
74b2466e | 39 | |
91b14d6f TG |
40 | unsigned n_ref; |
41 | ||
4e945a6f LP |
42 | DnsServerType type; |
43 | ||
3c0cf502 LP |
44 | Link *link; |
45 | ||
0dd25fb9 | 46 | int family; |
74b2466e LP |
47 | union in_addr_union address; |
48 | ||
9df3ba6c TG |
49 | usec_t resend_timeout; |
50 | usec_t max_rtt; | |
51 | ||
3c0cf502 | 52 | bool marked:1; |
74b2466e LP |
53 | |
54 | LIST_FIELDS(DnsServer, servers); | |
55 | }; | |
56 | ||
57 | int dns_server_new( | |
58 | Manager *m, | |
59 | DnsServer **s, | |
4e945a6f | 60 | DnsServerType type, |
74b2466e | 61 | Link *l, |
0dd25fb9 | 62 | int family, |
3c0cf502 | 63 | const union in_addr_union *address); |
74b2466e | 64 | |
91b14d6f TG |
65 | DnsServer* dns_server_ref(DnsServer *s); |
66 | DnsServer* dns_server_unref(DnsServer *s); | |
87f5a193 | 67 | |
9df3ba6c TG |
68 | void dns_server_packet_received(DnsServer *s, usec_t rtt); |
69 | void dns_server_packet_lost(DnsServer *s, usec_t usec); | |
70 | ||
8300ba21 TG |
71 | DEFINE_TRIVIAL_CLEANUP_FUNC(DnsServer*, dns_server_unref); |
72 | ||
d5099efc | 73 | extern const struct hash_ops dns_server_hash_ops; |