resolved-link.h revision 2c27fbca2d88214bd305272308a370a962818f1e
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba#pragma once
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba/***
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba This file is part of systemd.
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba Copyright 2014 Lennart Poettering
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba systemd is free software; you can redistribute it and/or modify it
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba under the terms of the GNU Lesser General Public License as published by
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba the Free Software Foundation; either version 2.1 of the License, or
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba (at your option) any later version.
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba systemd is distributed in the hope that it will be useful, but
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba WITHOUT ANY WARRANTY; without even the implied warranty of
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba Lesser General Public License for more details.
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba You should have received a copy of the GNU Lesser General Public License
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba along with systemd; If not, see <http://www.gnu.org/licenses/>.
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba***/
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba#include <net/if.h>
6031e9c7eb72435516a6828deb2e97533ed0382dludovicp
49ec0e527beda838ac41d558df188d2c7fa7a1c8ludo#include "in-addr-util.h"
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba#include "ratelimit.h"
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba
eef6695bc3b88e10d60477095ebddd4b9499481fpgambatypedef struct Link Link;
eef6695bc3b88e10d60477095ebddd4b9499481fpgambatypedef struct LinkAddress LinkAddress;
0b5792318cb29b979a4811a1aa237d35e3919830JnRouvignac
0b5792318cb29b979a4811a1aa237d35e3919830JnRouvignac#include "resolved-dns-server.h"
8b15572442aae50358e392562bd2e1ebfd5b2906matthew#include "resolved-dns-scope.h"
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba#include "resolved-dns-rr.h"
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba#include "resolved-manager.h"
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba
eef6695bc3b88e10d60477095ebddd4b9499481fpgambastruct LinkAddress {
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba Link *link;
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba int family;
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba union in_addr_union in_addr;
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba unsigned char flags, scope;
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba DnsResourceRecord *llmnr_address_rr;
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba DnsResourceRecord *llmnr_ptr_rr;
d729d88914866aa41d5d6dc5e7f6a7fb5f601bc3matthew
f38f1b1dd4d4521b3ab1160332de4f1767e6ddfamatthew LIST_FIELDS(LinkAddress, addresses);
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba};
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba
eef6695bc3b88e10d60477095ebddd4b9499481fpgambastruct Link {
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba Manager *manager;
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba int ifindex;
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba unsigned flags;
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba
d87eec6ea79502a1c14f1d960527ba986dfeb52cJnRouvignac LIST_HEAD(LinkAddress, addresses);
d87eec6ea79502a1c14f1d960527ba986dfeb52cJnRouvignac
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba LIST_HEAD(DnsServer, dns_servers);
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba DnsServer *current_dns_server;
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba DnsScope *unicast_scope;
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba DnsScope *llmnr_ipv4_scope;
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba DnsScope *llmnr_ipv6_scope;
0d397efc4b781ef5b60108708fa1131467d2c3c8gbellato
0d397efc4b781ef5b60108708fa1131467d2c3c8gbellato char name[IF_NAMESIZE];
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba uint32_t mtu;
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba RateLimit mdns_ratelimit;
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba RateLimit llmnr_ratelimit;
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba};
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba
eef6695bc3b88e10d60477095ebddd4b9499481fpgambaint link_new(Manager *m, Link **ret, int ifindex);
ea1dd4f3ba4c9d619a6c413f934507938a804f95ludoLink *link_free(Link *l);
ea1dd4f3ba4c9d619a6c413f934507938a804f95ludoint link_update_rtnl(Link *l, sd_rtnl_message *m);
ea1dd4f3ba4c9d619a6c413f934507938a804f95ludoint link_update_monitor(Link *l);
eef6695bc3b88e10d60477095ebddd4b9499481fpgambabool link_relevant(Link *l, int family);
eef6695bc3b88e10d60477095ebddd4b9499481fpgambaLinkAddress* link_find_address(Link *l, int family, const union in_addr_union *in_addr);
eef6695bc3b88e10d60477095ebddd4b9499481fpgambavoid link_add_rrs(Link *l, bool force_remove);
8b15572442aae50358e392562bd2e1ebfd5b2906matthew
8b15572442aae50358e392562bd2e1ebfd5b2906matthewDnsServer* link_set_dns_server(Link *l, DnsServer *s);
af0f03109bd00f4ccb3d6671bbc4e4f1a32ccbf9gbellatoDnsServer* link_find_dns_server(Link *l, int family, const union in_addr_union *in_addr);
eef6695bc3b88e10d60477095ebddd4b9499481fpgambaDnsServer* link_get_dns_server(Link *l);
eef6695bc3b88e10d60477095ebddd4b9499481fpgambavoid link_next_dns_server(Link *l);
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba
eef6695bc3b88e10d60477095ebddd4b9499481fpgambaint link_address_new(Link *l, LinkAddress **ret, int family, const union in_addr_union *in_addr);
eef6695bc3b88e10d60477095ebddd4b9499481fpgambaLinkAddress *link_address_free(LinkAddress *a);
eef6695bc3b88e10d60477095ebddd4b9499481fpgambaint link_address_update_rtnl(LinkAddress *a, sd_rtnl_message *m);
eef6695bc3b88e10d60477095ebddd4b9499481fpgambabool link_address_relevant(LinkAddress *l);
d87eec6ea79502a1c14f1d960527ba986dfeb52cJnRouvignacvoid link_address_add_rrs(LinkAddress *a, bool force_remove);
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba
eef6695bc3b88e10d60477095ebddd4b9499481fpgambaDEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_free);
eef6695bc3b88e10d60477095ebddd4b9499481fpgamba