1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
6 This file is part of systemd.
8 Copyright 2013 Tom Gundersen <teg@jklm.no>
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.
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.
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/>.
25 #include "sd-network.h"
29 #include "in-addr-util.h"
32 typedef struct Manager Manager;
34 #include "resolved-dns-query.h"
35 #include "resolved-dns-server.h"
36 #include "resolved-dns-scope.h"
47 sd_event_source *rtnl_event_source;
49 sd_network_monitor *network_monitor;
50 sd_event_source *network_event_source;
52 /* DNS query management */
53 Hashmap *dns_query_transactions;
54 LIST_HEAD(DnsQuery, dns_queries);
55 unsigned n_dns_queries;
61 sd_event_source *dns_ipv4_event_source;
62 sd_event_source *dns_ipv6_event_source;
64 LIST_HEAD(DnsServer, dns_servers);
65 DnsServer *current_dns_server;
67 LIST_HEAD(DnsScope, dns_scopes);
68 DnsScope *unicast_scope;
71 int llmnr_ipv4_udp_fd;
72 int llmnr_ipv6_udp_fd;
73 /* int llmnr_ipv4_tcp_fd; */
74 /* int llmnr_ipv6_tcp_fd; */
76 sd_event_source *llmnr_ipv4_udp_event_source;
77 sd_event_source *llmnr_ipv6_udp_event_source;
81 sd_event_source *bus_retry_event_source;
86 int manager_new(Manager **ret);
87 Manager* manager_free(Manager *m);
89 int manager_parse_config_file(Manager *m);
90 int manager_write_resolv_conf(Manager *m);
92 DnsServer* manager_find_dns_server(Manager *m, int family, union in_addr_union *in_addr);
93 DnsServer *manager_get_dns_server(Manager *m);
94 void manager_next_dns_server(Manager *m);
95 uint32_t manager_find_mtu(Manager *m);
97 int manager_send(Manager *m, int fd, int ifindex, int family, union in_addr_union *addr, uint16_t port, DnsPacket *p);
98 int manager_recv(Manager *m, int fd, DnsProtocol protocol, DnsPacket **ret);
100 int manager_dns_ipv4_fd(Manager *m);
101 int manager_dns_ipv6_fd(Manager *m);
102 int manager_llmnr_ipv4_udp_fd(Manager *m);
103 int manager_llmnr_ipv6_udp_fd(Manager *m);
105 int manager_connect_bus(Manager *m);
107 DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free);
109 const struct ConfigPerfItem* resolved_gperf_lookup(const char *key, unsigned length);
110 int config_parse_dnsv(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);