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