xref: /illumos-gate/usr/src/contrib/mDNSResponder/mDNSShared/mDNSFeatures.h (revision 472cd20d26008f77084ade4c2048159b98c2b705)
1 /*
2  * Copyright (c) 2019 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 __mDNSFeatures_h
18 #define __mDNSFeatures_h
19 
20 #if MDNSRESPONDER_PLATFORM_APPLE
21 #include "ApplePlatformFeatures.h"
22 #endif
23 
24 // Common Features
25 
26 #undef MDNSRESPONDER_PLATFORM_COMMON
27 #define MDNSRESPONDER_PLATFORM_COMMON       1
28 
29 // Feature: DNS Push
30 // Radar:   <rdar://problem/23226275>
31 // Enabled: Yes, for Apple.
32 
33 #if !defined(MDNSRESPONDER_SUPPORTS_COMMON_DNS_PUSH)
34     #if defined(MDNSRESPONDER_PLATFORM_APPLE) && MDNSRESPONDER_PLATFORM_APPLE
35         #define MDNSRESPONDER_SUPPORTS_COMMON_DNS_PUSH      1
36     #else
37         #define MDNSRESPONDER_SUPPORTS_COMMON_DNS_PUSH      0
38     #endif
39 #endif
40 
41 #define HAS_FEATURE_CAT(A, B)       A ## B
42 #define HAS_FEATURE_CHECK_0         1
43 #define HAS_FEATURE_CHECK_1         1
44 #define HAS_FEATURE(X)              ((X) / HAS_FEATURE_CAT(HAS_FEATURE_CHECK_, X))
45 
46 #define MDNSRESPONDER_SUPPORTS(PLATFORM, FEATURE) \
47     (defined(MDNSRESPONDER_PLATFORM_ ## PLATFORM) && MDNSRESPONDER_PLATFORM_ ## PLATFORM && \
48     HAS_FEATURE(MDNSRESPONDER_SUPPORTS_ ## PLATFORM ## _ ## FEATURE))
49 
50 #endif  // __mDNSFeatures_h
51