Imported Upstream version 765.50.9
[platform/upstream/mdnsresponder.git] / mDNSMacOSX / Private / dns_sd_private.h
1 /* -*- Mode: C; tab-width: 4 -*-
2  * 
3  * Copyright (c) 2015 Apple Inc. All rights reserved.
4  */
5
6 #ifndef _DNS_SD_PRIVATE_H
7 #define _DNS_SD_PRIVATE_H
8
9 /* DNSServiceCreateDelegateConnection()
10  *
11  * Parameters:
12  *
13  * sdRef:           A pointer to an uninitialized DNSServiceRef. Deallocating
14  *                  the reference (via DNSServiceRefDeallocate()) severs the
15  *                  connection and deregisters all records registered on this connection.
16  *
17  * pid :            Process ID of the delegate
18  *
19  * uuid:            UUID of the delegate
20  *
21  *                  Note that only one of the two arguments (pid or uuid) can be specified. If pid
22  *                  is zero, uuid will be assumed to be a valid value; otherwise pid will be used.
23  *
24  * return value:    Returns kDNSServiceErr_NoError on success, otherwise returns
25  *                  an error code indicating the specific failure that occurred (in which
26  *                  case the DNSServiceRef is not initialized). kDNSServiceErr_NotAuth is
27  *                  returned to indicate that the calling process does not have entitlements
28  *                  to use this API.
29  */
30 DNSServiceErrorType DNSSD_API DNSServiceCreateDelegateConnection(DNSServiceRef *sdRef, int32_t pid, uuid_t uuid);
31
32 // Map the source port of the local UDP socket that was opened for sending the DNS query
33 // to the process ID of the application that triggered the DNS resolution.
34 //
35 /* DNSServiceGetPID() Parameters:
36  *
37  * srcport:         Source port (in network byte order) of the UDP socket that was created by
38  *                  the daemon to send the DNS query on the wire.
39  *
40  * pid:             Process ID of the application that started the name resolution which triggered
41  *                  the daemon to send the query on the wire. The value can be -1 if the srcport
42  *                  cannot be mapped.
43  *
44  * return value:    Returns kDNSServiceErr_NoError on success, or kDNSServiceErr_ServiceNotRunning
45  *                  if the daemon is not running. The value of the pid is undefined if the return
46  *                  value has error.
47  */
48 DNSServiceErrorType DNSSD_API DNSServiceGetPID
49 (
50     uint16_t srcport,
51     int32_t *pid
52 );
53
54 #define kDNSServiceCompPrivateDNS   "PrivateDNS"
55 #define kDNSServiceCompMulticastDNS "MulticastDNS"
56
57 #endif