]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/resolve/resolved-dns-server.h
resolved: drop unused enum type
[thirdparty/systemd.git] / src / resolve / resolved-dns-server.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
3c0cf502
LP
24#include "in-addr-util.h"
25
74b2466e 26typedef struct DnsServer DnsServer;
74b2466e 27
4e945a6f
LP
28typedef enum DnsServerType {
29 DNS_SERVER_SYSTEM,
30 DNS_SERVER_FALLBACK,
31 DNS_SERVER_LINK,
32} DnsServerType;
33
3e684349
LP
34#include "resolved-link.h"
35
74b2466e
LP
36struct DnsServer {
37 Manager *manager;
74b2466e 38
91b14d6f
TG
39 unsigned n_ref;
40
4e945a6f
LP
41 DnsServerType type;
42
3c0cf502
LP
43 Link *link;
44
0dd25fb9 45 int family;
74b2466e
LP
46 union in_addr_union address;
47
9df3ba6c
TG
48 usec_t resend_timeout;
49 usec_t max_rtt;
50
3c0cf502 51 bool marked:1;
74b2466e 52
0eac4623
LP
53 /* If linked is set, then this server appears in the servers linked list */
54 bool linked:1;
74b2466e
LP
55 LIST_FIELDS(DnsServer, servers);
56};
57
58int dns_server_new(
59 Manager *m,
60 DnsServer **s,
4e945a6f 61 DnsServerType type,
74b2466e 62 Link *l,
0dd25fb9 63 int family,
3c0cf502 64 const union in_addr_union *address);
74b2466e 65
91b14d6f
TG
66DnsServer* dns_server_ref(DnsServer *s);
67DnsServer* dns_server_unref(DnsServer *s);
87f5a193 68
0eac4623
LP
69void dns_server_unlink(DnsServer *s);
70
9df3ba6c
TG
71void dns_server_packet_received(DnsServer *s, usec_t rtt);
72void dns_server_packet_lost(DnsServer *s, usec_t usec);
73
0eac4623 74DnsServer *manager_get_first_dns_server(Manager *m, DnsServerType t);
f2f1dbe5 75
636e813d
LP
76void manager_flush_dns_servers(Manager *m, DnsServerType t);
77void manager_flush_marked_dns_servers(Manager *m, DnsServerType type);
78void manager_mark_dns_servers(Manager *m, DnsServerType type);
79
0eac4623
LP
80DnsServer *manager_set_dns_server(Manager *m, DnsServer *s);
81DnsServer *manager_find_dns_server(Manager *m, DnsServerType t, int family, const union in_addr_union *in_addr);
82DnsServer *manager_get_dns_server(Manager *m);
83void manager_next_dns_server(Manager *m);
84
8300ba21
TG
85DEFINE_TRIVIAL_CLEANUP_FUNC(DnsServer*, dns_server_unref);
86
d5099efc 87extern const struct hash_ops dns_server_hash_ops;