]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/resolve/resolved-link.h
resolved: move dns server picking code from resolved-manager.c to resolved-dns-server.c
[thirdparty/systemd.git] / src / resolve / resolved-link.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
1716f6dc
LP
24#include <net/if.h>
25
74b2466e
LP
26#include "in-addr-util.h"
27#include "ratelimit.h"
28
29typedef struct Link Link;
30typedef struct LinkAddress LinkAddress;
31
623a4c97 32#include "resolved-dns-rr.h"
39d8db04 33#include "resolved-manager.h"
74b2466e
LP
34
35struct LinkAddress {
36 Link *link;
37
0dd25fb9 38 int family;
74b2466e
LP
39 union in_addr_union in_addr;
40
41 unsigned char flags, scope;
42
623a4c97
LP
43 DnsResourceRecord *llmnr_address_rr;
44 DnsResourceRecord *llmnr_ptr_rr;
45
74b2466e
LP
46 LIST_FIELDS(LinkAddress, addresses);
47};
48
49struct Link {
50 Manager *manager;
51
52 int ifindex;
53 unsigned flags;
54
55 LIST_HEAD(LinkAddress, addresses);
56
6073b6f2 57 LIST_HEAD(DnsServer, dns_servers);
74b2466e
LP
58 DnsServer *current_dns_server;
59
19b50b5b
LP
60 Support llmnr_support;
61
74b2466e 62 DnsScope *unicast_scope;
1716f6dc
LP
63 DnsScope *llmnr_ipv4_scope;
64 DnsScope *llmnr_ipv6_scope;
74b2466e 65
1716f6dc 66 char name[IF_NAMESIZE];
e1c95994 67 uint32_t mtu;
74b2466e
LP
68};
69
70int link_new(Manager *m, Link **ret, int ifindex);
71Link *link_free(Link *l);
1c4baffc 72int link_update_rtnl(Link *l, sd_netlink_message *m);
74b2466e 73int link_update_monitor(Link *l);
0dd25fb9 74bool link_relevant(Link *l, int family);
623a4c97 75LinkAddress* link_find_address(Link *l, int family, const union in_addr_union *in_addr);
ec2c5e43 76void link_add_rrs(Link *l, bool force_remove);
2c27fbca
LP
77
78DnsServer* link_set_dns_server(Link *l, DnsServer *s);
623a4c97 79DnsServer* link_find_dns_server(Link *l, int family, const union in_addr_union *in_addr);
74b2466e
LP
80DnsServer* link_get_dns_server(Link *l);
81void link_next_dns_server(Link *l);
82
623a4c97 83int link_address_new(Link *l, LinkAddress **ret, int family, const union in_addr_union *in_addr);
74b2466e 84LinkAddress *link_address_free(LinkAddress *a);
1c4baffc 85int link_address_update_rtnl(LinkAddress *a, sd_netlink_message *m);
74b2466e 86bool link_address_relevant(LinkAddress *l);
ec2c5e43 87void link_address_add_rrs(LinkAddress *a, bool force_remove);
74b2466e
LP
88
89DEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_free);