resolved-link.h revision 623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbf
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers#pragma once
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers/***
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers This file is part of systemd.
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers Copyright 2014 Lennart Poettering
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers systemd is free software; you can redistribute it and/or modify it
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers under the terms of the GNU Lesser General Public License as published by
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers the Free Software Foundation; either version 2.1 of the License, or
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers (at your option) any later version.
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers systemd is distributed in the hope that it will be useful, but
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers WITHOUT ANY WARRANTY; without even the implied warranty of
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers Lesser General Public License for more details.
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers
d23965a64eb5c2c97b839dc2e3e79fc1613994f1Kay Sievers You should have received a copy of the GNU Lesser General Public License
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sievers along with systemd; If not, see <http://www.gnu.org/licenses/>.
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sievers***/
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sievers
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sievers#include <net/if.h>
d23965a64eb5c2c97b839dc2e3e79fc1613994f1Kay Sievers
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sievers#include "in-addr-util.h"
de892aea1c486b59e04884268b612081d1660514Kay Sievers#include "ratelimit.h"
de892aea1c486b59e04884268b612081d1660514Kay Sievers
de892aea1c486b59e04884268b612081d1660514Kay Sieverstypedef struct Link Link;
de892aea1c486b59e04884268b612081d1660514Kay Sieverstypedef struct LinkAddress LinkAddress;
d23965a64eb5c2c97b839dc2e3e79fc1613994f1Kay Sievers
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sievers#include "resolved.h"
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sievers#include "resolved-dns-server.h"
de892aea1c486b59e04884268b612081d1660514Kay Sievers#include "resolved-dns-scope.h"
de892aea1c486b59e04884268b612081d1660514Kay Sievers#include "resolved-dns-rr.h"
de892aea1c486b59e04884268b612081d1660514Kay Sievers
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sieversstruct LinkAddress {
de892aea1c486b59e04884268b612081d1660514Kay Sievers Link *link;
de892aea1c486b59e04884268b612081d1660514Kay Sievers
de892aea1c486b59e04884268b612081d1660514Kay Sievers int family;
d23965a64eb5c2c97b839dc2e3e79fc1613994f1Kay Sievers union in_addr_union in_addr;
d23965a64eb5c2c97b839dc2e3e79fc1613994f1Kay Sievers
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers unsigned char flags, scope;
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers DnsResourceRecord *llmnr_address_rr;
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers DnsResourceRecord *llmnr_ptr_rr;
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers LIST_FIELDS(LinkAddress, addresses);
de892aea1c486b59e04884268b612081d1660514Kay Sievers};
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers
a660c63c551b88136ac6176855b5907cc533e848Kay Sieversstruct Link {
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers Manager *manager;
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sievers
5b8180d3f6598a1b2f296645690de41d726fd5abKay Sievers int ifindex;
d23965a64eb5c2c97b839dc2e3e79fc1613994f1Kay Sievers unsigned flags;
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sievers
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sievers LIST_HEAD(LinkAddress, addresses);
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sievers
d23965a64eb5c2c97b839dc2e3e79fc1613994f1Kay Sievers LIST_HEAD(DnsServer, dns_servers);
a660c63c551b88136ac6176855b5907cc533e848Kay Sievers DnsServer *current_dns_server;
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sievers
5b8180d3f6598a1b2f296645690de41d726fd5abKay Sievers DnsScope *unicast_scope;
01d183ddae6fb3445c4519cf1d90c6575f17292eKay Sievers DnsScope *llmnr_ipv4_scope;
01d183ddae6fb3445c4519cf1d90c6575f17292eKay Sievers DnsScope *llmnr_ipv6_scope;
5b8180d3f6598a1b2f296645690de41d726fd5abKay Sievers
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sievers char name[IF_NAMESIZE];
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sievers uint32_t mtu;
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sievers
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sievers RateLimit mdns_ratelimit;
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sievers RateLimit llmnr_ratelimit;
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sievers};
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sievers
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sieversint link_new(Manager *m, Link **ret, int ifindex);
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay SieversLink *link_free(Link *l);
d23965a64eb5c2c97b839dc2e3e79fc1613994f1Kay Sieversint link_update_rtnl(Link *l, sd_rtnl_message *m);
5b8180d3f6598a1b2f296645690de41d726fd5abKay Sieversint link_update_monitor(Link *l);
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sieversbool link_relevant(Link *l, int family);
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay SieversLinkAddress* link_find_address(Link *l, int family, const union in_addr_union *in_addr);
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sievers
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay SieversDnsServer* link_find_dns_server(Link *l, int family, const union in_addr_union *in_addr);
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay SieversDnsServer* link_get_dns_server(Link *l);
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sieversvoid link_next_dns_server(Link *l);
0035597a30d120f70df2dd7da3d6128fb8ba6051Kay Sievers
d23965a64eb5c2c97b839dc2e3e79fc1613994f1Kay Sieversint link_address_new(Link *l, LinkAddress **ret, int family, const union in_addr_union *in_addr);
de892aea1c486b59e04884268b612081d1660514Kay SieversLinkAddress *link_address_free(LinkAddress *a);
de892aea1c486b59e04884268b612081d1660514Kay Sieversint link_address_update_rtnl(LinkAddress *a, sd_rtnl_message *m);
de892aea1c486b59e04884268b612081d1660514Kay Sieversbool link_address_relevant(LinkAddress *l);
de892aea1c486b59e04884268b612081d1660514Kay Sievers
de892aea1c486b59e04884268b612081d1660514Kay SieversDEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_free);
de892aea1c486b59e04884268b612081d1660514Kay Sievers