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