1 /* -*- Mode: C; tab-width: 4 -*-
3 * Copyright (c) 2015-2016 Apple Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
21 #if ENABLE_BLE_TRIGGERED_BONJOUR
24 #include "dns_sd_internal.h"
26 typedef unsigned long serviceHash_t;
28 bool shouldUseBLE(mDNSInterfaceID interfaceID, DNS_TypeValues rrtype, domainname *serviceType, domainname *domain);
30 void start_BLE_browse(mDNSInterfaceID InterfaceID, const domainname *const domain, DNS_TypeValues type, DNSServiceFlags flags,
31 mDNSu8 *key, size_t keySize);
32 bool stop_BLE_browse(mDNSInterfaceID InterfaceID, const domainname *const domain, DNS_TypeValues type, DNSServiceFlags flags);
34 void start_BLE_advertise(const ResourceRecord *const resourceRecord, const domainname *const domain, DNS_TypeValues type, DNSServiceFlags flags);
35 void stop_BLE_advertise(const domainname *const domain, DNS_TypeValues type, DNSServiceFlags flags);
37 void responseReceived(serviceHash_t peerBloomFilter, mDNSEthAddr *ptrToMAC);
39 void serviceBLE(void);
41 // C interfaces to Objective-C beacon management code.
42 void updateBLEBeacon(serviceHash_t bloomFilter);
43 void stopBLEBeacon(void);
44 void startBLEScan(void);
45 void stopBLEScan(void);
46 bool currentlyBeaconing(void);
48 extern bool suppressBeacons;
49 extern bool finalBeacon;
51 extern mDNS mDNSStorage;
52 extern mDNSBool EnableBLEBasedDiscovery;
53 extern mDNSBool DefaultToBLETriggered;
55 extern mDNSInterfaceID AWDLInterfaceID;
56 #define applyToBLE(interface, flags) ((interface == mDNSInterface_BLE) || (((interface == mDNSInterface_Any) || (interface == AWDLInterfaceID)) && (flags & kDNSServiceFlagsAutoTrigger)))
59 #pragma mark - Unit test declarations
61 // Unit test entry points, which are not used in the mDNSResponder runtime code paths.
62 void BLE_unitTest(void);
66 #endif // ENABLE_BLE_TRIGGERED_BONJOUR