]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/resolve/resolved-link.h
resolved,networkd: unify ResolveSupport enum
[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"
af49ca27 28#include "resolve-util.h"
74b2466e
LP
29
30typedef struct Link Link;
31typedef struct LinkAddress LinkAddress;
32
623a4c97 33#include "resolved-dns-rr.h"
a51c1048
LP
34#include "resolved-dns-search-domain.h"
35#include "resolved-dns-server.h"
39d8db04 36#include "resolved-manager.h"
74b2466e 37
eed857b7
LP
38#define LINK_SEARCH_DOMAINS_MAX 32
39#define LINK_DNS_SERVERS_MAX 32
40
74b2466e
LP
41struct LinkAddress {
42 Link *link;
43
0dd25fb9 44 int family;
74b2466e
LP
45 union in_addr_union in_addr;
46
47 unsigned char flags, scope;
48
623a4c97
LP
49 DnsResourceRecord *llmnr_address_rr;
50 DnsResourceRecord *llmnr_ptr_rr;
51
74b2466e
LP
52 LIST_FIELDS(LinkAddress, addresses);
53};
54
55struct Link {
56 Manager *manager;
57
58 int ifindex;
59 unsigned flags;
60
61 LIST_HEAD(LinkAddress, addresses);
62
6073b6f2 63 LIST_HEAD(DnsServer, dns_servers);
74b2466e 64 DnsServer *current_dns_server;
eed857b7 65 unsigned n_dns_servers;
74b2466e 66
a51c1048 67 LIST_HEAD(DnsSearchDomain, search_domains);
eed857b7 68 unsigned n_search_domains;
a51c1048 69
af49ca27
LP
70 ResolveSupport llmnr_support;
71 ResolveSupport mdns_support;
19b50b5b 72
74b2466e 73 DnsScope *unicast_scope;
1716f6dc
LP
74 DnsScope *llmnr_ipv4_scope;
75 DnsScope *llmnr_ipv6_scope;
b4f1862d
DM
76 DnsScope *mdns_ipv4_scope;
77 DnsScope *mdns_ipv6_scope;
74b2466e 78
1716f6dc 79 char name[IF_NAMESIZE];
e1c95994 80 uint32_t mtu;
74b2466e
LP
81};
82
83int link_new(Manager *m, Link **ret, int ifindex);
84Link *link_free(Link *l);
1c4baffc 85int link_update_rtnl(Link *l, sd_netlink_message *m);
74b2466e 86int link_update_monitor(Link *l);
0dd25fb9 87bool link_relevant(Link *l, int family);
623a4c97 88LinkAddress* link_find_address(Link *l, int family, const union in_addr_union *in_addr);
ec2c5e43 89void link_add_rrs(Link *l, bool force_remove);
2c27fbca
LP
90
91DnsServer* link_set_dns_server(Link *l, DnsServer *s);
74b2466e
LP
92DnsServer* link_get_dns_server(Link *l);
93void link_next_dns_server(Link *l);
94
623a4c97 95int link_address_new(Link *l, LinkAddress **ret, int family, const union in_addr_union *in_addr);
74b2466e 96LinkAddress *link_address_free(LinkAddress *a);
1c4baffc 97int link_address_update_rtnl(LinkAddress *a, sd_netlink_message *m);
74b2466e 98bool link_address_relevant(LinkAddress *l);
ec2c5e43 99void link_address_add_rrs(LinkAddress *a, bool force_remove);
74b2466e
LP
100
101DEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_free);