]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSMacOSX/D2D.h
mDNSResponder-1310.80.1.tar.gz
[apple/mdnsresponder.git] / mDNSMacOSX / D2D.h
1 /* -*- Mode: C; tab-width: 4 -*-
2 *
3 * Copyright (c) 2015-2020 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 _D2D_H_
19 #define _D2D_H_
20
21 #include "mDNSEmbeddedAPI.h" // Defines the interface provided to the client layer above
22 #include "dnssd_ipc.h"
23 #include <DeviceToDeviceManager/DeviceToDeviceManager.h>
24
25 extern void internal_start_browsing_for_service(mDNSInterfaceID InterfaceID, const domainname *const type, DNS_TypeValues qtype, DNSServiceFlags flags, pid_t clientPID);
26 extern void internal_stop_browsing_for_service(mDNSInterfaceID InterfaceID, const domainname *const type, DNS_TypeValues qtype, DNSServiceFlags flags, pid_t clientPID);
27 extern void internal_start_advertising_service(const ResourceRecord *const resourceRecord, DNSServiceFlags flags, pid_t clientPID);
28 extern void internal_stop_advertising_service(const ResourceRecord *const resourceRecord, DNSServiceFlags flags, pid_t clientPID);
29
30 void xD2DAddToCache(D2DStatus result, D2DServiceInstance instanceHandle, D2DTransportType transportType, const Byte *key, size_t keySize, const Byte *value, size_t valueSize);
31 void xD2DRemoveFromCache(D2DStatus result, D2DServiceInstance instanceHandle, D2DTransportType transportType, const Byte *key, size_t keySize, const Byte *value, size_t valueSize);
32
33 extern mDNSBool callExternalHelpers(mDNSInterfaceID InterfaceID, const domainname *const domain, DNSServiceFlags flags);
34 extern mDNSu32 deriveD2DFlagsFromAuthRecType(AuthRecType authRecType);
35 extern void external_start_browsing_for_service(mDNSInterfaceID InterfaceID, const domainname *const type, DNS_TypeValues qtype, DNSServiceFlags flags, pid_t clientPID);
36 extern void external_stop_browsing_for_service(mDNSInterfaceID InterfaceID, const domainname *const type, DNS_TypeValues qtype, DNSServiceFlags flags, pid_t clientPID);
37 extern void external_start_advertising_service(const ResourceRecord *const resourceRecord, DNSServiceFlags flags, pid_t clientPID);
38 extern void external_stop_advertising_service(const ResourceRecord *const resourceRecord, DNSServiceFlags flags, pid_t clientPID);
39 extern void external_start_resolving_service(mDNSInterfaceID InterfaceID, const domainname *const fqdn, DNSServiceFlags flags, pid_t clientPID);
40 extern void external_stop_resolving_service(mDNSInterfaceID InterfaceID, const domainname *const fqdn, DNSServiceFlags flags, pid_t clientPID);
41 extern void external_connection_release(const domainname *instance);
42
43 extern void D2D_start_advertising_interface(NetworkInterfaceInfo *interface);
44 extern void D2D_stop_advertising_interface(NetworkInterfaceInfo *interface);
45 extern void D2D_start_advertising_record(AuthRecord *ar);
46 extern void D2D_stop_advertising_record(AuthRecord *ar);
47
48 #if ENABLE_BLE_TRIGGERED_BONJOUR
49 // Just define as the current max value for now for BLE.c prototype.
50 // TODO: Will need to define in DeviceToDeviceManager.framework if we convert the
51 // BLE discovery code to a D2D plugin.
52 #define D2DBLETransport D2DTransportMax
53 #endif // ENABLE_BLE_TRIGGERED_BONJOUR
54
55 #ifdef UNIT_TEST
56 #pragma mark - Unit test declarations
57
58 // Unit test entry points, which are not used in the mDNSResponder runtime code paths.
59 void D2D_unitTest(void);
60
61 #endif // UNIT_TEST
62
63 #endif /* _D2D_H_ */