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