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