]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSMacOSX/ApplePlatformFeatures.h
mDNSResponder-1310.40.42.tar.gz
[apple/mdnsresponder.git] / mDNSMacOSX / ApplePlatformFeatures.h
1 /*
2 * Copyright (c) 2018-2020 Apple Inc. All rights reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #ifndef __ApplePlatformFeatures_h
18 #define __ApplePlatformFeatures_h
19
20 #include <TargetConditionals.h>
21
22 // Feature: Bonjour-On-Demand
23 // Radar: <rdar://problem/23523784>
24 // Enabled: Yes.
25
26 #if !defined(MDNSRESPONDER_SUPPORTS_APPLE_BONJOUR_ON_DEMAND)
27 #define MDNSRESPONDER_SUPPORTS_APPLE_BONJOUR_ON_DEMAND 1
28 #endif
29
30 // Feature: Cache memory limit
31 // Radar: <rdar://problem/15629764>
32 // Enabled: Yes, but only for device OSes, such as iOS, tvOS, and watchOS, i.e., when TARGET_OS_IPHONE is 1.
33
34 #if !defined(MDNSRESPONDER_SUPPORTS_APPLE_CACHE_MEM_LIMIT)
35 #if !defined(TARGET_OS_IPHONE)
36 #error "Expected TARGET_OS_IPHONE to be defined."
37 #endif
38 #if TARGET_OS_IPHONE
39 #define MDNSRESPONDER_SUPPORTS_APPLE_CACHE_MEM_LIMIT 1
40 #else
41 #define MDNSRESPONDER_SUPPORTS_APPLE_CACHE_MEM_LIMIT 0
42 #endif
43 #endif
44
45 // Feature: D2D
46 // Radar: <rdar://problem/28062515>
47 // Enabled: Yes.
48
49 #if !defined(MDNSRESPONDER_SUPPORTS_APPLE_D2D)
50 #define MDNSRESPONDER_SUPPORTS_APPLE_D2D 1
51 #endif
52
53 // Feature: DNS64 support for DNS proxy
54 // Radar: <rdar://problem/56505415>
55 // Enabled: Yes.
56
57 #if !defined(MDNSRESPONDER_SUPPORTS_APPLE_DNS_PROXY_DNS64)
58 #define MDNSRESPONDER_SUPPORTS_APPLE_DNS_PROXY_DNS64 1
59 #endif
60
61 // Feature: DNS64 IPv6 synthesis.
62 // Radar: <rdar://problem/32297396>
63 // Enabled: Yes, but only for iOS and macOS, which support the DNS proxy network extension.
64
65 #if !defined(MDNSRESPONDER_SUPPORTS_APPLE_DNS64)
66 #if (!defined(TARGET_OS_IOS) || !defined(TARGET_OS_OSX))
67 #error "Expected TARGET_OS_IOS and TARGET_OS_OSX to be defined."
68 #endif
69 #if (TARGET_OS_IOS || TARGET_OS_OSX)
70 #define MDNSRESPONDER_SUPPORTS_APPLE_DNS64 1
71 #else
72 #define MDNSRESPONDER_SUPPORTS_APPLE_DNS64 0
73 #endif
74 #endif
75
76 // Feature: DNS-SD XPC service
77 // Radar: <rdar://problem/43866363>
78 // Enabled: Yes.
79
80 #if !defined(MDNSRESPONDER_SUPPORTS_APPLE_DNSSD_XPC_SERVICE)
81 #define MDNSRESPONDER_SUPPORTS_APPLE_DNSSD_XPC_SERVICE 1
82 #endif
83
84 // Feature: Ignore /etc/hosts file on customer builds.
85 // Radar: <rdar://problem/34745220>
86 // Enabled: Yes, except for macOS.
87
88 #if !defined(MDNSRESPONDER_SUPPORTS_APPLE_IGNORE_HOSTS_FILE)
89 #if !defined(TARGET_OS_OSX)
90 #error "Expected TARGET_OS_OSX to be defined."
91 #endif
92 #if !TARGET_OS_OSX
93 #define MDNSRESPONDER_SUPPORTS_APPLE_IGNORE_HOSTS_FILE 1
94 #else
95 #define MDNSRESPONDER_SUPPORTS_APPLE_IGNORE_HOSTS_FILE 0
96 #endif
97 #endif
98
99 // Feature: AWD metrics collection
100 // Radar: <rdar://problem/24146300>
101 // Enabled: Yes, but for iOS only.
102
103 #if !defined(MDNSRESPONDER_SUPPORTS_APPLE_METRICS)
104 #if !defined(TARGET_OS_IOS)
105 #error "Expected TARGET_OS_IOS to be defined."
106 #endif
107 #if TARGET_OS_IOS
108 #define MDNSRESPONDER_SUPPORTS_APPLE_METRICS 1
109 #else
110 #define MDNSRESPONDER_SUPPORTS_APPLE_METRICS 0
111 #endif
112 #endif
113
114 // Feature: No system wake for network access.
115 // Radar: <rdar://problem/28079659&55038229>
116 // Enabled: Yes, but only for iOS and watchOS, which shouldn't act as sleep-proxy clients.
117
118 #if !defined(MDNSRESPONDER_SUPPORTS_APPLE_NO_WAKE_FOR_NET_ACCESS)
119 #if (!defined(TARGET_OS_IOS) || !defined(TARGET_OS_WATCH))
120 #error "Expected TARGET_OS_IOS and TARGET_OS_WATCH to be defined."
121 #endif
122 #if (TARGET_OS_IOS || TARGET_OS_WATCH)
123 #define MDNSRESPONDER_SUPPORTS_APPLE_NO_WAKE_FOR_NET_ACCESS 1
124 #else
125 #define MDNSRESPONDER_SUPPORTS_APPLE_NO_WAKE_FOR_NET_ACCESS 0
126 #endif
127 #endif
128
129 // Feature: Support for having finer granularity of log redaction, by using os_log based-log routine.
130 // Radar: <rdar://problem/42814956>
131 // Enabled: Yes.
132
133 #if !defined(MDNSRESPONDER_SUPPORTS_APPLE_OS_LOG)
134 #define MDNSRESPONDER_SUPPORTS_APPLE_OS_LOG 1
135 #endif
136
137 // Feature: Preallocate mDNSResponder's cache memory. For testing purposes only.
138 // Radar: <rdar://problem/29545890>
139 // Enabled: No.
140
141 #if !defined(MDNSRESPONDER_SUPPORTS_APPLE_PREALLOCATED_CACHE)
142 #define MDNSRESPONDER_SUPPORTS_APPLE_PREALLOCATED_CACHE 0
143 #endif
144
145 // Feature: Use mdns_querier objects for DNS transports.
146 // Radar: <rdar://problem/55746371>
147 // Enabled: Yes.
148
149 #if !defined(MDNSRESPONDER_SUPPORTS_APPLE_QUERIER)
150 #define MDNSRESPONDER_SUPPORTS_APPLE_QUERIER 1
151 #endif
152
153 // Feature: Randomized AWDL Hostname
154 // Radar: <rdar://problem/47525004>
155 // Enabled: Yes.
156
157 #if !defined(MDNSRESPONDER_SUPPORTS_APPLE_RANDOM_AWDL_HOSTNAME)
158 #define MDNSRESPONDER_SUPPORTS_APPLE_RANDOM_AWDL_HOSTNAME 1
159 #endif
160
161 // Feature: Reachability trigger
162 // Radar: <rdar://problem/11374446>
163 // Enabled: Yes.
164
165 #if !defined(MDNSRESPONDER_SUPPORTS_APPLE_REACHABILITY_TRIGGER)
166 #define MDNSRESPONDER_SUPPORTS_APPLE_REACHABILITY_TRIGGER 1
167 #endif
168
169 // Feature: "SlowActivation" processing for flapping interfaces.
170 // Disabled to address stale Bonjour record issues during flapping network interface transitions.
171 // Radar: <rdar://problem/44694746>
172 // Enabled: No.
173
174 #if !defined(MDNSRESPONDER_SUPPORTS_APPLE_SLOW_ACTIVATION)
175 #define MDNSRESPONDER_SUPPORTS_APPLE_SLOW_ACTIVATION 0
176 #endif
177
178 // Feature: Support for performing dot-local queries via mDNS and DNS in parallel.
179 // Radar: <rdar://problem/4786302>
180 // Enabled: Yes.
181
182 #if !defined(MDNSRESPONDER_SUPPORTS_APPLE_UNICAST_DOTLOCAL)
183 #define MDNSRESPONDER_SUPPORTS_APPLE_UNICAST_DOTLOCAL 1
184 #endif
185
186 // Feature: Allow browses and registrations over interfaces that aren't ready yet.
187 // Radar: <rdar://problem/20181903>
188 // Enabled: Yes.
189
190 #if !defined(MDNSRESPONDER_SUPPORTS_APPLE_UNREADY_INTERFACES)
191 #define MDNSRESPONDER_SUPPORTS_APPLE_UNREADY_INTERFACES 1
192 #endif
193
194 // Feature: Support for Web Content Filter
195 // Radar: <rdar://problem/7409981>
196 // Enabled: Yes, if SDK has <WebFilterDNS/WebFilterDNS.h>.
197
198 #if !defined(MDNSRESPONDER_SUPPORTS_APPLE_WEB_CONTENT_FILTER)
199 #if __has_include(<WebFilterDNS/WebFilterDNS.h>)
200 #define MDNSRESPONDER_SUPPORTS_APPLE_WEB_CONTENT_FILTER 1
201 #else
202 #define MDNSRESPONDER_SUPPORTS_APPLE_WEB_CONTENT_FILTER 0
203 #endif
204 #endif
205
206 // Feature: Support for Analytics For Cache
207 // Radar: <rdar://problem/52206048>
208 // Enabled: iOS & macOS
209
210 #if !defined(MDNSRESPONDER_SUPPORTS_APPLE_CACHE_ANALYTICS)
211 #if !(defined(TARGET_OS_IOS) && defined(TARGET_OS_OSX))
212 #error "Expected TARGET_OS_IOS && TARGET_OS_OSX to be defined."
213 #endif
214 #if (TARGET_OS_IOS || TARGET_OS_OSX)
215 #define MDNSRESPONDER_SUPPORTS_APPLE_CACHE_ANALYTICS 1
216 #else
217 #define MDNSRESPONDER_SUPPORTS_APPLE_CACHE_ANALYTICS 0
218 #endif
219 #endif
220
221 // Feature: Support for Analytics For WAB (Wide Area Bonjour)
222 // Radar: <rdar://problem/52136688>
223 // Enabled: iOS & macOS
224
225 #if !defined(MDNSRESPONDER_SUPPORTS_APPLE_WAB_ANALYTICS)
226 #define MDNSRESPONDER_SUPPORTS_APPLE_WAB_ANALYTICS 0
227 #endif
228
229 // Feature: Support for Analytics
230 // Enabled: If any analytics are enabled (above)
231
232 #if !defined(MDNSRESPONDER_SUPPORTS_APPLE_ANALYTICS)
233 #if (MDNSRESPONDER_SUPPORTS_APPLE_CACHE_ANALYTICS || MDNSRESPONDER_SUPPORTS_APPLE_WAB_ANALYTICS)
234 #define MDNSRESPONDER_SUPPORTS_APPLE_ANALYTICS 1
235 #else
236 #define MDNSRESPONDER_SUPPORTS_APPLE_ANALYTICS 0
237 #endif
238 #endif
239
240 // Feature: Add audit token to questions
241 // Radar: <rdar://problem/59042213>
242 // Enabled: On all Apple platforms
243
244 #if !defined(MDNSRESPONDER_SUPPORTS_APPLE_AUDIT_TOKEN)
245 #define MDNSRESPONDER_SUPPORTS_APPLE_AUDIT_TOKEN 1
246 #endif
247
248 // Feature: Enforce entitlements prompts
249 // Radar: <rdar://problem/55922132>
250 // Enabled: iOS only (depends on MDNSRESPONDER_SUPPORTS_APPLE_AUDIT_TOKEN)
251
252 #if !defined(MDNSRESPONDER_SUPPORTS_APPLE_TRUST_ENFORCEMENT)
253 #if MDNSRESPONDER_SUPPORTS_APPLE_AUDIT_TOKEN
254 #if (TARGET_OS_IOS)
255 #define MDNSRESPONDER_SUPPORTS_APPLE_TRUST_ENFORCEMENT 1
256 #else
257 #define MDNSRESPONDER_SUPPORTS_APPLE_TRUST_ENFORCEMENT 0
258 #endif
259 #else
260 #define MDNSRESPONDER_SUPPORTS_APPLE_TRUST_ENFORCEMENT 0
261 #endif
262 #endif
263
264 // Feature: Symptoms Reporting
265 // Radar: <rdar://problem/20194922>
266 // Enabled: Yes. (depends on MDNSRESPONDER_SUPPORTS_APPLE_AUDIT_TOKEN)
267
268 #if !defined(MDNSRESPONDER_SUPPORTS_APPLE_SYMPTOMS)
269 #if MDNSRESPONDER_SUPPORTS_APPLE_AUDIT_TOKEN
270 #define MDNSRESPONDER_SUPPORTS_APPLE_SYMPTOMS 1
271 #else
272 #define MDNSRESPONDER_SUPPORTS_APPLE_SYMPTOMS 0
273 #endif
274 #endif
275
276 #if !defined(MDNSRESPONDER_SUPPORTS_APPLE_IPC_TLV)
277 #define MDNSRESPONDER_SUPPORTS_APPLE_IPC_TLV 1
278 #endif
279
280 // Feature: DNSSEC support
281 // Radar: <rdar://problem/55275552>
282 // Enabled: On all Apple platforms
283 // Notes:
284 // MDNSRESPONDER_SUPPORTS(APPLE, QUERIER) should always be true if MDNSRESPONDER_SUPPORTS(APPLE, DNSSECv2)
285 // is true, except for only one case, the Tests target that runs XCTest. In the XCTest,
286 // MDNSRESPONDER_SUPPORTS_APPLE_DNSSECv2 is predefined in the preprocess which does not check what
287 // MDNSRESPONDER_SUPPORTS checks. In order to test DNSSEC functions in XCtest without querier support, we
288 // will wrap all DNSSEC code that calls querier, since the code will never be excuted in XCTest.
289 #if !defined(MDNSRESPONDER_SUPPORTS_APPLE_DNSSECv2)
290 #if MDNSRESPONDER_SUPPORTS_APPLE_QUERIER
291 #define MDNSRESPONDER_SUPPORTS_APPLE_DNSSECv2 0
292 #else
293 #define MDNSRESPONDER_SUPPORTS_APPLE_DNSSECv2 0
294 #endif
295 #endif
296
297 #endif // __ApplePlatformFeatures_h