]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSMacOSX/DNSServiceDiscovery.h
mDNSResponder-1310.80.1.tar.gz
[apple/mdnsresponder.git] / mDNSMacOSX / DNSServiceDiscovery.h
1 /* -*- Mode: C; tab-width: 4 -*-
2 *
3 * Copyright (c) 2002-2018 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 /*! @header DNS Service Discovery (Deprecated Mach-based API)
19 *
20 * @discussion Note that this API was deprecated in Mac OS X 10.3, and replaced
21 * by the portable cross-platform /usr/include/dns_sd.h API.
22 */
23
24 #ifndef __DNS_SERVICE_DISCOVERY_H
25 #define __DNS_SERVICE_DISCOVERY_H
26
27 #include <mach/mach_types.h>
28
29 #include <sys/types.h>
30 #include <sys/socket.h>
31 #include <sys/cdefs.h>
32
33 #include <netinet/in.h>
34 #include <os/availability.h>
35
36 #define kDNSServiceDiscoveryDeprecatedMsg "This API was deprecated in Mac OS X 10.3 and replaced by the portable cross-platform /usr/include/dns_sd.h API"
37
38 __BEGIN_DECLS
39
40 /* Opaque internal data type */
41 typedef struct _dns_service_discovery_t * dns_service_discovery_ref;
42
43 /* possible reply flags values */
44
45 enum {
46 kDNSServiceDiscoveryNoFlags = 0,
47 kDNSServiceDiscoveryMoreRepliesImmediately = 1 << 0,
48 };
49
50
51 typedef enum
52 {
53 DNSServiceDomainEnumerationReplyAddDomain,
54 DNSServiceDomainEnumerationReplyAddDomainDefault,
55 DNSServiceDomainEnumerationReplyRemoveDomain,
56 } DNSServiceDomainEnumerationReplyResultType;
57
58 typedef enum
59 {
60 DNSServiceDiscoverReplyFlagsFinished,
61 DNSServiceDiscoverReplyFlagsMoreComing,
62 } DNSServiceDiscoveryReplyFlags;
63
64 typedef void (*DNSServiceDomainEnumerationReply)(
65 DNSServiceDomainEnumerationReplyResultType resultType, // One of DNSServiceDomainEnumerationReplyResultType
66 const char *replyDomain,
67 DNSServiceDiscoveryReplyFlags flags, // DNS Service Discovery reply flags information
68 void *context
69 );
70
71
72 /* possible error code values */
73 typedef enum
74 {
75 kDNSServiceDiscoveryNoError = 0,
76 } DNSServiceRegistrationReplyErrorType;
77
78 typedef void (*DNSServiceRegistrationReply)(
79 DNSServiceRegistrationReplyErrorType errorCode,
80 void *context
81 );
82
83 typedef uint32_t DNSRecordReference;
84
85
86 /*!
87 @function DNSServiceResolver_handleReply
88 @discussion This function should be called with the Mach message sent
89 to the port returned by the call to DNSServiceResolverResolve.
90 The reply message will be interpreted and will result in a
91 call to the specified callout function.
92 @param replyMsg The Mach message.
93 */
94 void DNSServiceDiscovery_handleReply(void *replyMsg) API_DEPRECATED(kDNSServiceDiscoveryDeprecatedMsg, macos(10.2, 10.3));
95
96 /***************************************************************************/
97 /* DNS Service Browser */
98
99 typedef enum
100 {
101 DNSServiceBrowserReplyAddInstance, // Instance of service found
102 DNSServiceBrowserReplyRemoveInstance // Instance has been removed from network
103 } DNSServiceBrowserReplyResultType;
104
105 typedef void (*DNSServiceBrowserReply)(
106 DNSServiceBrowserReplyResultType resultType, // One of DNSServiceBrowserReplyResultType
107 const char *replyName,
108 const char *replyType,
109 const char *replyDomain,
110 DNSServiceDiscoveryReplyFlags flags, // DNS Service Discovery reply flags information
111 void *context
112 );
113
114 /*!
115 @function DNSServiceBrowserCreate
116 @discussion Asynchronously create a DNS Service browser
117 @param regtype The type of service
118 @param domain The domain in which to find the service
119 @param callBack The function to be called when service instances are found or removed
120 @param context A user specified context which will be passed to the callout function.
121 @result A dns_registration_t
122 */
123 dns_service_discovery_ref DNSServiceBrowserCreate
124 (
125 const char *regtype,
126 const char *domain,
127 DNSServiceBrowserReply callBack,
128 void *context
129 ) API_DEPRECATED(kDNSServiceDiscoveryDeprecatedMsg, macos(10.2, 10.3));
130
131 /***************************************************************************/
132 /* Resolver requests */
133
134 typedef void (*DNSServiceResolverReply)(
135 struct sockaddr *interface, // Needed for scoped addresses like link-local
136 struct sockaddr *address,
137 const char *txtRecord,
138 DNSServiceDiscoveryReplyFlags flags, // DNS Service Discovery reply flags information
139 void *context
140 );
141
142 /*!
143 @function DNSServiceResolverResolve
144 @discussion Resolved a named instance of a service to its address, port, and
145 (optionally) other demultiplexing information contained in the TXT record.
146 @param name The name of the service instance
147 @param regtype The type of service
148 @param domain The domain in which to find the service
149 @param callBack The DNSServiceResolverReply function to be called when the specified
150 address has been resolved.
151 @param context A user specified context which will be passed to the callout function.
152 @result A dns_registration_t
153 */
154
155 dns_service_discovery_ref DNSServiceResolverResolve
156 (
157 const char *name,
158 const char *regtype,
159 const char *domain,
160 DNSServiceResolverReply callBack,
161 void *context
162 ) API_DEPRECATED(kDNSServiceDiscoveryDeprecatedMsg, macos(10.2, 10.3));
163
164 /***************************************************************************/
165 /* Mach port accessor and deallocation */
166
167 /*!
168 @function DNSServiceDiscoveryMachPort
169 @discussion Returns the mach port for a dns_service_discovery_ref
170 @param registration A dns_service_discovery_ref as returned from DNSServiceRegistrationCreate
171 @result A mach reply port which will be sent messages as appropriate.
172 These messages should be passed to the DNSServiceDiscovery_handleReply
173 function. A NULL value indicates that no address was
174 specified or some other error occurred which prevented the
175 resolution from being started.
176 */
177 mach_port_t DNSServiceDiscoveryMachPort(dns_service_discovery_ref dnsServiceDiscovery) API_DEPRECATED(kDNSServiceDiscoveryDeprecatedMsg, macos(10.2, 10.3));
178
179 /*!
180 @function DNSServiceDiscoveryDeallocate
181 @discussion Deallocates the DNS Service Discovery type / closes the connection to the server
182 @param dnsServiceDiscovery A dns_service_discovery_ref as returned from a creation or enumeration call
183 @result void
184 */
185 void DNSServiceDiscoveryDeallocate(dns_service_discovery_ref dnsServiceDiscovery) API_DEPRECATED(kDNSServiceDiscoveryDeprecatedMsg, macos(10.2, 10.3));
186
187 __END_DECLS
188
189 #endif /* __DNS_SERVICE_DISCOVERY_H */