]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/resolve/resolved-link.h
resolved: add a DNS client stub resolver
[thirdparty/systemd.git] / src / resolve / resolved-link.h
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 "in-addr-util.h"
25 #include "ratelimit.h"
26
27 typedef struct Link Link;
28 typedef struct LinkAddress LinkAddress;
29
30 #include "resolved.h"
31 #include "resolved-dns-server.h"
32 #include "resolved-dns-scope.h"
33
34 struct LinkAddress {
35 Link *link;
36
37 unsigned char family;
38 union in_addr_union in_addr;
39
40 unsigned char flags, scope;
41
42 LIST_FIELDS(LinkAddress, addresses);
43 };
44
45 struct Link {
46 Manager *manager;
47
48 int ifindex;
49 unsigned flags;
50
51 LIST_HEAD(LinkAddress, addresses);
52
53 LIST_HEAD(DnsServer, link_dns_servers);
54 LIST_HEAD(DnsServer, dhcp_dns_servers);
55 DnsServer *current_dns_server;
56
57 DnsScope *unicast_scope;
58 DnsScope *mdns_ipv4_scope;
59 DnsScope *mdns_ipv6_scope;
60
61 size_t mtu;
62
63 char *operational_state;
64
65 RateLimit mdns_ratelimit;
66 };
67
68 int link_new(Manager *m, Link **ret, int ifindex);
69 Link *link_free(Link *l);
70 int link_update_rtnl(Link *l, sd_rtnl_message *m);
71 int link_update_monitor(Link *l);
72 bool link_relevant(Link *l);
73 LinkAddress* link_find_address(Link *l, unsigned char family, union in_addr_union *in_addr);
74
75 DnsServer* link_find_dns_server(Link *l, DnsServerSource source, unsigned char family, union in_addr_union *in_addr);
76 DnsServer* link_get_dns_server(Link *l);
77 void link_next_dns_server(Link *l);
78
79 int link_address_new(Link *l, LinkAddress **ret, unsigned char family, union in_addr_union *in_addr);
80 LinkAddress *link_address_free(LinkAddress *a);
81 int link_address_update_rtnl(LinkAddress *a, sd_rtnl_message *m);
82 bool link_address_relevant(LinkAddress *l);
83
84 DEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_free);