resolved-link.h revision ad6c04756115809d615dede330213d73edf732a8
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen#pragma once
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen/***
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen This file is part of systemd.
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen Copyright 2014 Lennart Poettering
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen systemd is free software; you can redistribute it and/or modify it
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen under the terms of the GNU Lesser General Public License as published by
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen the Free Software Foundation; either version 2.1 of the License, or
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen (at your option) any later version.
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen systemd is distributed in the hope that it will be useful, but
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen WITHOUT ANY WARRANTY; without even the implied warranty of
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen Lesser General Public License for more details.
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen You should have received a copy of the GNU Lesser General Public License
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen along with systemd; If not, see <http://www.gnu.org/licenses/>.
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen***/
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen#include <net/if.h>
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen#include "in-addr-util.h"
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen#include "ratelimit.h"
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen#include "resolve-util.h"
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersentypedef struct Link Link;
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersentypedef struct LinkAddress LinkAddress;
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen#include "resolved-dns-rr.h"
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen#include "resolved-dns-search-domain.h"
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen#include "resolved-dns-server.h"
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen#include "resolved-manager.h"
920b52e4909d9dc812817fd8b82f83ca23a11c91Thomas Hindoe Paaboel Andersen
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen#define LINK_SEARCH_DOMAINS_MAX 32
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen#define LINK_DNS_SERVERS_MAX 32
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersenstruct LinkAddress {
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen Link *link;
79008bddf679a5e0900369950eb346c9fa687107Lennart Poettering
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen int family;
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen union in_addr_union in_addr;
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen
79008bddf679a5e0900369950eb346c9fa687107Lennart Poettering unsigned char flags, scope;
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen DnsResourceRecord *llmnr_address_rr;
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen DnsResourceRecord *llmnr_ptr_rr;
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen LIST_FIELDS(LinkAddress, addresses);
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen};
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersenstruct Link {
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen Manager *manager;
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen int ifindex;
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen unsigned flags;
79008bddf679a5e0900369950eb346c9fa687107Lennart Poettering
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen LIST_HEAD(LinkAddress, addresses);
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen LIST_HEAD(DnsServer, dns_servers);
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen DnsServer *current_dns_server;
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen unsigned n_dns_servers;
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen LIST_HEAD(DnsSearchDomain, search_domains);
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen unsigned n_search_domains;
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen ResolveSupport llmnr_support;
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen ResolveSupport mdns_support;
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen DnssecMode dnssec_mode;
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen DnsScope *unicast_scope;
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen DnsScope *llmnr_ipv4_scope;
1c4baffc1895809bae9ac36b670af90a4cb9cd7dTom Gundersen DnsScope *llmnr_ipv6_scope;
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen DnsScope *mdns_ipv4_scope;
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen DnsScope *mdns_ipv6_scope;
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen char name[IF_NAMESIZE];
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen uint32_t mtu;
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen};
1c4baffc1895809bae9ac36b670af90a4cb9cd7dTom Gundersen
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersenint link_new(Manager *m, Link **ret, int ifindex);
79008bddf679a5e0900369950eb346c9fa687107Lennart PoetteringLink *link_free(Link *l);
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersenint link_update_rtnl(Link *l, sd_netlink_message *m);
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersenint link_update_monitor(Link *l);
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersenbool link_relevant(Link *l, int family);
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom GundersenLinkAddress* link_find_address(Link *l, int family, const union in_addr_union *in_addr);
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersenvoid link_add_rrs(Link *l, bool force_remove);
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom GundersenDnsServer* link_set_dns_server(Link *l, DnsServer *s);
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom GundersenDnsServer* link_get_dns_server(Link *l);
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersenvoid link_next_dns_server(Link *l);
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersenint link_address_new(Link *l, LinkAddress **ret, int family, const union in_addr_union *in_addr);
1c4baffc1895809bae9ac36b670af90a4cb9cd7dTom GundersenLinkAddress *link_address_free(LinkAddress *a);
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersenint link_address_update_rtnl(LinkAddress *a, sd_netlink_message *m);
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersenbool link_address_relevant(LinkAddress *l);
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersenvoid link_address_add_rrs(LinkAddress *a, bool force_remove);
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom GundersenDEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_free);
b22d8a00f48f3c5fc4510b4acd3e1a43e731e592Tom Gundersen