1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3 
4 #include <inttypes.h>
5 
6 #include "time-util.h"
7 
8 /* Input + Output: The various protocols we can use */
9 #define SD_RESOLVED_DNS             (UINT64_C(1) << 0)
10 #define SD_RESOLVED_LLMNR_IPV4      (UINT64_C(1) << 1)
11 #define SD_RESOLVED_LLMNR_IPV6      (UINT64_C(1) << 2)
12 #define SD_RESOLVED_MDNS_IPV4       (UINT64_C(1) << 3)
13 #define SD_RESOLVED_MDNS_IPV6       (UINT64_C(1) << 4)
14 
15 /* Input: Don't follow CNAMEs/DNAMEs */
16 #define SD_RESOLVED_NO_CNAME        (UINT64_C(1) << 5)
17 
18 /* Input: When doing service (SRV) resolving, don't resolve associated mDNS-style TXT records */
19 #define SD_RESOLVED_NO_TXT          (UINT64_C(1) << 6)
20 
21 /* Input: When doing service (SRV) resolving, don't resolve A/AAA RR for included hostname */
22 #define SD_RESOLVED_NO_ADDRESS      (UINT64_C(1) << 7)
23 
24 /* Input: Don't apply search domain logic to request */
25 #define SD_RESOLVED_NO_SEARCH       (UINT64_C(1) << 8)
26 
27 /* Output: Result is authenticated */
28 #define SD_RESOLVED_AUTHENTICATED   (UINT64_C(1) << 9)
29 
30 /* Input: Don't DNSSEC validate request */
31 #define SD_RESOLVED_NO_VALIDATE     (UINT64_C(1) << 10)
32 
33 /* Input: Don't answer request from locally synthesized records (which includes /etc/hosts) */
34 #define SD_RESOLVED_NO_SYNTHESIZE   (UINT64_C(1) << 11)
35 
36 /* Input: Don't answer request from cache */
37 #define SD_RESOLVED_NO_CACHE        (UINT64_C(1) << 12)
38 
39 /* Input: Don't answer request from locally registered public LLMNR/mDNS RRs */
40 #define SD_RESOLVED_NO_ZONE         (UINT64_C(1) << 13)
41 
42 /* Input: Don't answer request from locally configured trust anchors. */
43 #define SD_RESOLVED_NO_TRUST_ANCHOR (UINT64_C(1) << 14)
44 
45 /* Input: Don't go to network for this request */
46 #define SD_RESOLVED_NO_NETWORK      (UINT64_C(1) << 15)
47 
48 /* Input: Require that request is answered from a "primary" answer, i.e. not from RRs acquired as
49  * side-effect of a previous transaction */
50 #define SD_RESOLVED_REQUIRE_PRIMARY (UINT64_C(1) << 16)
51 
52 /* Input: If reply is answered from cache, the TTLs will be adjusted by age of cache entry */
53 #define SD_RESOLVED_CLAMP_TTL       (UINT64_C(1) << 17)
54 
55 /* Output: Result was only sent via encrypted channels, or never left this system */
56 #define SD_RESOLVED_CONFIDENTIAL    (UINT64_C(1) << 18)
57 
58 /* Output: Result was (at least partially) synthesized locally */
59 #define SD_RESOLVED_SYNTHETIC       (UINT64_C(1) << 19)
60 
61 /* Output: Result was (at least partially) answered from cache */
62 #define SD_RESOLVED_FROM_CACHE      (UINT64_C(1) << 20)
63 
64 /* Output: Result was (at least partially) answered from local zone */
65 #define SD_RESOLVED_FROM_ZONE       (UINT64_C(1) << 21)
66 
67 /* Output: Result was (at least partially) answered from trust anchor */
68 #define SD_RESOLVED_FROM_TRUST_ANCHOR (UINT64_C(1) << 22)
69 
70 /* Output: Result was (at least partially) answered from network */
71 #define SD_RESOLVED_FROM_NETWORK    (UINT64_C(1) << 23)
72 
73 #define SD_RESOLVED_LLMNR           (SD_RESOLVED_LLMNR_IPV4|SD_RESOLVED_LLMNR_IPV6)
74 #define SD_RESOLVED_MDNS            (SD_RESOLVED_MDNS_IPV4|SD_RESOLVED_MDNS_IPV6)
75 #define SD_RESOLVED_PROTOCOLS_ALL   (SD_RESOLVED_MDNS|SD_RESOLVED_LLMNR|SD_RESOLVED_DNS)
76 
77 #define SD_RESOLVED_FROM_MASK       (SD_RESOLVED_FROM_CACHE|SD_RESOLVED_FROM_ZONE|SD_RESOLVED_FROM_TRUST_ANCHOR|SD_RESOLVED_FROM_NETWORK)
78 
79 #define SD_RESOLVED_QUERY_TIMEOUT_USEC (120 * USEC_PER_SEC)
80