2017-11-18 17:09:20 +01:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
2014-08-14 01:00:15 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
/***
|
|
|
|
This file is part of systemd.
|
|
|
|
|
|
|
|
Copyright 2014 Lennart Poettering
|
|
|
|
|
|
|
|
systemd is free software; you can redistribute it and/or modify it
|
|
|
|
under the terms of the GNU Lesser General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2.1 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
systemd is distributed in the hope that it will be useful, but
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
|
|
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
***/
|
|
|
|
|
2016-02-07 18:37:23 +01:00
|
|
|
#include <inttypes.h>
|
|
|
|
|
2018-01-23 01:53:31 +01:00
|
|
|
#include "time-util.h"
|
|
|
|
|
2015-11-26 22:45:42 +01:00
|
|
|
#define SD_RESOLVED_DNS (UINT64_C(1) << 0)
|
|
|
|
#define SD_RESOLVED_LLMNR_IPV4 (UINT64_C(1) << 1)
|
|
|
|
#define SD_RESOLVED_LLMNR_IPV6 (UINT64_C(1) << 2)
|
2015-07-11 02:44:46 +02:00
|
|
|
#define SD_RESOLVED_MDNS_IPV4 (UINT64_C(1) << 3)
|
|
|
|
#define SD_RESOLVED_MDNS_IPV6 (UINT64_C(1) << 4)
|
2015-11-26 22:45:42 +01:00
|
|
|
#define SD_RESOLVED_NO_CNAME (UINT64_C(1) << 5)
|
|
|
|
#define SD_RESOLVED_NO_TXT (UINT64_C(1) << 6)
|
|
|
|
#define SD_RESOLVED_NO_ADDRESS (UINT64_C(1) << 7)
|
|
|
|
#define SD_RESOLVED_NO_SEARCH (UINT64_C(1) << 8)
|
2015-12-03 21:04:52 +01:00
|
|
|
#define SD_RESOLVED_AUTHENTICATED (UINT64_C(1) << 9)
|
2014-08-14 01:00:15 +02:00
|
|
|
|
resolved: add ResolveService() bus call for resolving SRV and DNS-SD services
This also adds client-side support for this to systemd-resolve-host.
Note that the ResolveService() API can deal both with DNS-SD service
(consisting of service name, type and domain), as well as classic SRV
services (consisting just of a type and a domain), all exposed in the
same call.
This patch also reworks CNAME handling in order to reuse it between
hostname, RR and service lookups.
In contrast to Avahi and Bonjour, this new API will actually reolve the
A/AAAA RRs the SRV RRs point to in one go (unless this is explicitly
disabled). This normally comes for free, as these RRs are sent along
the SRV responses anyway, hence let's make use of that. This makes the
API considerably easier to use, as a single ResolveService() invocation
will return all necessary data to pick a server and connect() to it.
Note that this only implements the DNS-SD resolving step, it does not
implement DNS-SD browsing, as that makes sense primarily on mDNS, due to
its continuous nature.
2015-11-23 21:25:40 +01:00
|
|
|
#define SD_RESOLVED_LLMNR (SD_RESOLVED_LLMNR_IPV4|SD_RESOLVED_LLMNR_IPV6)
|
2015-07-11 02:44:46 +02:00
|
|
|
#define SD_RESOLVED_MDNS (SD_RESOLVED_MDNS_IPV4|SD_RESOLVED_MDNS_IPV6)
|
|
|
|
|
|
|
|
#define SD_RESOLVED_PROTOCOLS_ALL (SD_RESOLVED_MDNS|SD_RESOLVED_LLMNR|SD_RESOLVED_DNS)
|
2018-01-23 01:53:31 +01:00
|
|
|
|
|
|
|
#define SD_RESOLVED_QUERY_TIMEOUT_USEC (120 * USEC_PER_SEC)
|
2018-02-27 17:48:54 +01:00
|
|
|
|
|
|
|
/* 127.0.0.53 in native endian */
|
|
|
|
#define INADDR_DNS_STUB ((in_addr_t) 0x7f000035U)
|