]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/resolve/resolved-link.h
barrier: fix race in test-code
[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
32#include "resolved.h"
33#include "resolved-dns-server.h"
34#include "resolved-dns-scope.h"
35
36struct LinkAddress {
37 Link *link;
38
0dd25fb9 39 int family;
74b2466e
LP
40 union in_addr_union in_addr;
41
42 unsigned char flags, scope;
43
44 LIST_FIELDS(LinkAddress, addresses);
45};
46
47struct Link {
48 Manager *manager;
49
50 int ifindex;
51 unsigned flags;
52
53 LIST_HEAD(LinkAddress, addresses);
54
6073b6f2 55 LIST_HEAD(DnsServer, dns_servers);
74b2466e
LP
56 DnsServer *current_dns_server;
57
58 DnsScope *unicast_scope;
1716f6dc
LP
59 DnsScope *llmnr_ipv4_scope;
60 DnsScope *llmnr_ipv6_scope;
74b2466e 61
1716f6dc 62 char name[IF_NAMESIZE];
e1c95994 63 uint32_t mtu;
74b2466e 64
74b2466e 65 RateLimit mdns_ratelimit;
1716f6dc 66 RateLimit llmnr_ratelimit;
74b2466e
LP
67};
68
69int link_new(Manager *m, Link **ret, int ifindex);
70Link *link_free(Link *l);
71int link_update_rtnl(Link *l, sd_rtnl_message *m);
72int link_update_monitor(Link *l);
0dd25fb9
LP
73bool link_relevant(Link *l, int family);
74LinkAddress* link_find_address(Link *l, int family, union in_addr_union *in_addr);
74b2466e 75
6073b6f2 76DnsServer* link_find_dns_server(Link *l, int family, union in_addr_union *in_addr);
74b2466e
LP
77DnsServer* link_get_dns_server(Link *l);
78void link_next_dns_server(Link *l);
79
0dd25fb9 80int link_address_new(Link *l, LinkAddress **ret, int family, union in_addr_union *in_addr);
74b2466e
LP
81LinkAddress *link_address_free(LinkAddress *a);
82int link_address_update_rtnl(LinkAddress *a, sd_rtnl_message *m);
83bool link_address_relevant(LinkAddress *l);
84
85DEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_free);