]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSMacOSX/BLE.h
mDNSResponder-1310.60.4.tar.gz
[apple/mdnsresponder.git] / mDNSMacOSX / BLE.h
1 /* -*- Mode: C; tab-width: 4 -*-
2 *
3 * Copyright (c) 2015-2016 Apple Inc. All rights reserved.
4 *
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
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
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.
16 */
17
18 #ifndef _BLE_H_
19 #define _BLE_H_
20
21 #if ENABLE_BLE_TRIGGERED_BONJOUR
22
23 #include "dns_sd.h"
24 #include "dns_sd_internal.h"
25
26 typedef unsigned long serviceHash_t;
27
28 bool shouldUseBLE(mDNSInterfaceID interfaceID, DNS_TypeValues rrtype, domainname *serviceType, domainname *domain);
29
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);
33
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);
36
37 void responseReceived(serviceHash_t peerBloomFilter, mDNSEthAddr *ptrToMAC);
38
39 void serviceBLE(void);
40
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);
47
48 extern bool suppressBeacons;
49 extern bool finalBeacon;
50
51 extern mDNS mDNSStorage;
52 extern mDNSBool EnableBLEBasedDiscovery;
53 extern mDNSBool DefaultToBLETriggered;
54
55 extern mDNSInterfaceID AWDLInterfaceID;
56 #define applyToBLE(interface, flags) ((interface == mDNSInterface_BLE) || (((interface == mDNSInterface_Any) || (interface == AWDLInterfaceID)) && (flags & kDNSServiceFlagsAutoTrigger)))
57
58 #ifdef UNIT_TEST
59 #pragma mark - Unit test declarations
60
61 // Unit test entry points, which are not used in the mDNSResponder runtime code paths.
62 void BLE_unitTest(void);
63
64 #endif // UNIT_TEST
65
66 #endif // ENABLE_BLE_TRIGGERED_BONJOUR
67
68 #endif /* _BLE_H_ */