1 /* -*- Mode: C; tab-width: 4 -*- 2 * 3 * Copyright (c) 2015-2018 Apple Inc. All rights reserved. 4 */ 5 6 #ifndef _DNS_SD_PRIVATE_H 7 #define _DNS_SD_PRIVATE_H 8 9 #include <dns_sd.h> 10 11 // Private flags (kDNSServiceFlagsPrivateOne, kDNSServiceFlagsPrivateTwo, kDNSServiceFlagsPrivateThree, kDNSServiceFlagsPrivateFour) from dns_sd.h 12 enum 13 { 14 kDNSServiceFlagsDenyCellular = 0x8000000, 15 /* 16 * This flag is meaningful only for Unicast DNS queries. When set, the daemon will restrict 17 * DNS resolutions on the cellular interface for that request. 18 */ 19 kDNSServiceFlagsServiceIndex = 0x10000000, 20 /* 21 * This flag is meaningful only for DNSServiceGetAddrInfo() for Unicast DNS queries. 22 * When set, DNSServiceGetAddrInfo() will interpret the "interfaceIndex" argument of the call 23 * as the "serviceIndex". 24 */ 25 26 kDNSServiceFlagsDenyExpensive = 0x20000000, 27 /* 28 * This flag is meaningful only for Unicast DNS queries. When set, the daemon will restrict 29 * DNS resolutions on interfaces defined as expensive for that request. 30 */ 31 32 kDNSServiceFlagsPathEvaluationDone = 0x40000000 33 /* 34 * This flag is meaningful for only Unicast DNS queries. 35 * When set, it indicates that Network PathEvaluation has already been performed. 36 */ 37 }; 38 39 40 #if !DNSSD_NO_CREATE_DELEGATE_CONNECTION 41 /* DNSServiceCreateDelegateConnection() 42 * 43 * Parameters: 44 * 45 * sdRef: A pointer to an uninitialized DNSServiceRef. Deallocating 46 * the reference (via DNSServiceRefDeallocate()) severs the 47 * connection and deregisters all records registered on this connection. 48 * 49 * pid : Process ID of the delegate 50 * 51 * uuid: UUID of the delegate 52 * 53 * Note that only one of the two arguments (pid or uuid) can be specified. If pid 54 * is zero, uuid will be assumed to be a valid value; otherwise pid will be used. 55 * 56 * return value: Returns kDNSServiceErr_NoError on success, otherwise returns 57 * an error code indicating the specific failure that occurred (in which 58 * case the DNSServiceRef is not initialized). kDNSServiceErr_NotAuth is 59 * returned to indicate that the calling process does not have entitlements 60 * to use this API. 61 */ 62 DNSSD_EXPORT 63 DNSServiceErrorType DNSSD_API DNSServiceCreateDelegateConnection(DNSServiceRef *sdRef, int32_t pid, uuid_t uuid); 64 #endif 65 66 // Map the source port of the local UDP socket that was opened for sending the DNS query 67 // to the process ID of the application that triggered the DNS resolution. 68 // 69 /* DNSServiceGetPID() Parameters: 70 * 71 * srcport: Source port (in network byte order) of the UDP socket that was created by 72 * the daemon to send the DNS query on the wire. 73 * 74 * pid: Process ID of the application that started the name resolution which triggered 75 * the daemon to send the query on the wire. The value can be -1 if the srcport 76 * cannot be mapped. 77 * 78 * return value: Returns kDNSServiceErr_NoError on success, or kDNSServiceErr_ServiceNotRunning 79 * if the daemon is not running. The value of the pid is undefined if the return 80 * value has error. 81 */ 82 DNSSD_EXPORT 83 DNSServiceErrorType DNSSD_API DNSServiceGetPID 84 ( 85 uint16_t srcport, 86 int32_t *pid 87 ); 88 89 DNSSD_EXPORT 90 DNSServiceErrorType DNSSD_API DNSServiceSetDefaultDomainForUser(DNSServiceFlags flags, const char *domain); 91 92 #define kDNSServiceCompPrivateDNS "PrivateDNS" 93 #define kDNSServiceCompMulticastDNS "MulticastDNS" 94 95 #endif 96