]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSWindows/DNSServices/DNSServiceDiscovery.c
mDNSResponder-66.3.tar.gz
[apple/mdnsresponder.git] / mDNSWindows / DNSServices / DNSServiceDiscovery.c
1 /*
2 * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24
25 Change History (most recent first):
26
27 $Log: DNSServiceDiscovery.c,v $
28 Revision 1.7 2004/05/08 12:24:48 bradley
29 Removed trailing character from zero value to fix compile error.
30
31 Revision 1.6 2004/05/06 18:42:58 ksekar
32 General dns_sd.h API cleanup, including the following radars:
33 <rdar://problem/3592068>: Remove flags with zero value
34 <rdar://problem/3479569>: Passing in NULL causes a crash.
35
36 Revision 1.5 2004/01/30 02:56:34 bradley
37 Updated to support full Unicode display. Added support for all services on www.dns-sd.org.
38
39 Revision 1.4 2003/11/14 20:59:10 cheshire
40 Clients can't use AssignDomainName macro because mDNSPlatformMemCopy is defined in mDNSPlatformFunctions.h.
41 Best solution is just to combine mDNSClientAPI.h and mDNSPlatformFunctions.h into a single file.
42
43 Revision 1.3 2003/10/04 04:47:08 bradley
44 Changed DNSServiceRegistrationCreate to treat the port in network byte order for end-to-end consistency.
45
46 Revision 1.2 2003/08/20 07:06:34 bradley
47 Update to APSL 2.0. Updated change history to match other mDNSResponder files.
48
49 Revision 1.1 2003/08/20 06:04:45 bradley
50 Platform-neutral DNSServices-based emulation layer for the Mac OS X DNSServiceDiscovery API.
51
52 */
53
54 #include <stddef.h>
55 #include <stdlib.h>
56 #include <string.h>
57
58 #if( macintosh || __MACH__ )
59
60 #include <sys/types.h>
61 #include <sys/socket.h>
62 #include <netinet/in.h>
63
64 #elif( defined( _MSC_VER ) || defined( __MWERKS__ ) )
65
66 #pragma warning( disable:4054 ) // Disable "type cast : from function pointer to data pointer".
67 #pragma warning( disable:4055 ) // Disable "type cast : from data pointer to function pointer".
68 #pragma warning( disable:4127 ) // Disable "conditional expression is constant" warning for debug macros.
69 #pragma warning( disable:4152 ) // Disable "nonstandard extension, function/data pointer conversion in expression".
70
71 #define WIN32_LEAN_AND_MEAN // Needed to avoid redefinitions by Windows interfaces.
72
73 #include <winsock2.h>
74
75 #endif
76
77 #include "mDNSClientAPI.h"
78 #include "DNSServices.h"
79
80 #include "DNSServiceDiscovery.h"
81
82 #ifdef __cplusplus
83 extern "C" {
84 #endif
85
86 #if 0
87 #pragma mark == Constants & Types ==
88 #endif
89
90 //===========================================================================================================================
91 // Constants & Types
92 //===========================================================================================================================
93
94 #define DEBUG_NAME "[DNSServiceDiscovery] "
95
96 typedef enum
97 {
98 kDNSServiceDiscoveryObjectTypeRegistration = 1,
99 kDNSServiceDiscoveryObjectTypeDomainEnumeration = 2,
100 kDNSServiceDiscoveryObjectTypeBrowser = 3,
101 kDNSServiceDiscoveryObjectTypeResolver = 4
102
103 } DNSServiceDiscoveryObjectType;
104
105 typedef struct _dns_service_discovery_t _dns_service_discovery_t;
106 struct _dns_service_discovery_t
107 {
108 DNSServiceDiscoveryObjectType type;
109 void * ref;
110 void * callback;
111 void * context;
112 };
113
114 #if 0
115 #pragma mark == Macros ==
116 #endif
117
118 //===========================================================================================================================
119 // Macros
120 //===========================================================================================================================
121
122 // Emulate Mac OS debugging macros for non-Mac platforms.
123
124 #if( !TARGET_OS_MAC )
125 #define check(assertion)
126 #define check_string( assertion, cstring )
127 #define check_noerr(err)
128 #define check_noerr_string( error, cstring )
129 #define debug_string( cstring )
130 #define require( assertion, label ) do { if( !(assertion) ) goto label; } while(0)
131 #define require_string( assertion, label, string ) require(assertion, label)
132 #define require_quiet( assertion, label ) require( assertion, label )
133 #define require_noerr( error, label ) do { if( (error) != 0 ) goto label; } while(0)
134 #define require_noerr_quiet( assertion, label ) require_noerr( assertion, label )
135 #define require_noerr_action( error, label, action ) do { if( (error) != 0 ) { {action;}; goto label; } } while(0)
136 #define require_noerr_action_quiet( assertion, label, action ) require_noerr_action( assertion, label, action )
137 #define require_action( assertion, label, action ) do { if( !(assertion) ) { {action;}; goto label; } } while(0)
138 #define require_action_quiet( assertion, label, action ) require_action( assertion, label, action )
139 #define require_action_string( assertion, label, action, cstring ) do { if( !(assertion) ) { {action;}; goto label; } } while(0)
140 #endif
141
142 #if 0
143 #pragma mark == Prototypes ==
144 #endif
145
146 //===========================================================================================================================
147 // Prototypes
148 //===========================================================================================================================
149
150 DNS_LOCAL void
151 DNSServiceRegistrationPrivateCallBack(
152 void * inContext,
153 DNSRegistrationRef inRef,
154 DNSStatus inStatusCode,
155 const DNSRegistrationEvent * inEvent );
156
157 DNS_LOCAL void
158 DNSServiceDomainEnumerationPrivateCallBack(
159 void * inContext,
160 DNSBrowserRef inRef,
161 DNSStatus inStatusCode,
162 const DNSBrowserEvent * inEvent );
163
164 DNS_LOCAL void
165 DNSServiceBrowserPrivateCallBack(
166 void * inContext,
167 DNSBrowserRef inRef,
168 DNSStatus inStatusCode,
169 const DNSBrowserEvent * inEvent );
170
171 DNS_LOCAL void
172 DNSServiceResolverPrivateCallBack(
173 void * inContext,
174 DNSResolverRef inRef,
175 DNSStatus inStatusCode,
176 const DNSResolverEvent * inEvent );
177
178 #if 0
179 #pragma mark -
180 #endif
181
182 //===========================================================================================================================
183 // DNSServiceRegistrationCreate
184 //===========================================================================================================================
185
186 dns_service_discovery_ref
187 DNSServiceRegistrationCreate(
188 const char * inName,
189 const char * inType,
190 const char * inDomain,
191 uint16_t inPort,
192 const char * inTextRecord,
193 DNSServiceRegistrationReply inCallBack,
194 void * inContext )
195 {
196 DNSStatus err;
197 dns_service_discovery_ref result;
198 dns_service_discovery_ref obj;
199 void * txt;
200 size_t txtSize;
201 DNSOpaque16 port;
202 DNSRegistrationRef registration;
203
204 result = NULL;
205 txt = NULL;
206 txtSize = 0;
207
208 // Allocate and initialize the object.
209
210 obj = (dns_service_discovery_ref) malloc( sizeof( *obj ) );
211 require_action( obj, exit, err = kDNSNoMemoryErr );
212
213 obj->type = kDNSServiceDiscoveryObjectTypeRegistration;
214 obj->ref = NULL;
215 obj->callback = inCallBack;
216 obj->context = inContext;
217
218 // Create the underlying registration. Build a \001-escaped text record if needed.
219
220 if( inTextRecord )
221 {
222 err = DNSDynamicTextRecordBuildEscaped( inTextRecord, &txt, &txtSize );
223 require_noerr( err, exit );
224 }
225
226 port.v8[ 0 ] = (DNSUInt8)( inPort >> 8 );
227 port.v8[ 1 ] = (DNSUInt8)( inPort & 0xFF );
228 err = DNSRegistrationCreate( kDNSRegistrationFlagPreFormattedTextRecord, inName, inType, inDomain, port.v16, txt,
229 (DNSCount) txtSize, NULL, NULL, DNSServiceRegistrationPrivateCallBack, obj, &registration );
230 require_noerr( err, exit );
231 obj->ref = registration;
232
233 // Success!
234
235 result = obj;
236 obj = NULL;
237
238 exit:
239 if( txt )
240 {
241 DNSDynamicTextRecordRelease( txt );
242 }
243 if( obj )
244 {
245 DNSServiceDiscoveryDeallocate( obj );
246 }
247 return( result );
248 }
249
250 //===========================================================================================================================
251 // DNSServiceRegistrationPrivateCallBack
252 //===========================================================================================================================
253
254 DNS_LOCAL void
255 DNSServiceRegistrationPrivateCallBack(
256 void * inContext,
257 DNSRegistrationRef inRef,
258 DNSStatus inStatusCode,
259 const DNSRegistrationEvent * inEvent )
260 {
261 dns_service_discovery_ref obj;
262 DNSServiceRegistrationReply callback;
263
264 DNS_UNUSED( inRef );
265 DNS_UNUSED( inStatusCode );
266
267 check( inContext );
268 obj = (dns_service_discovery_ref) inContext;
269 check( obj->callback );
270 callback = (DNSServiceRegistrationReply) obj->callback;
271
272 switch( inEvent->type )
273 {
274 case kDNSRegistrationEventTypeRegistered:
275 debugf( DEBUG_NAME "name registered and active\n" );
276
277 if( callback )
278 {
279 callback( kDNSServiceDiscoveryNoError, obj->context );
280 }
281 break;
282
283 case kDNSRegistrationEventTypeNameCollision:
284 debugf( DEBUG_NAME "name in use, please choose another name\n" );
285
286 if( callback )
287 {
288 callback( kDNSServiceDiscoveryNameConflict, obj->context );
289 }
290 break;
291
292 default:
293 break;
294 }
295 }
296
297 //===========================================================================================================================
298 // DNSServiceRegistrationAddRecord
299 //===========================================================================================================================
300
301 DNSRecordReference
302 DNSServiceRegistrationAddRecord(
303 dns_service_discovery_ref inRef,
304 uint16_t inRRType,
305 uint16_t inRDLength,
306 const char * inRData,
307 uint32_t inTTL )
308 {
309 DNS_UNUSED( inRef );
310 DNS_UNUSED( inRRType );
311 DNS_UNUSED( inRDLength );
312 DNS_UNUSED( inRData );
313 DNS_UNUSED( inTTL );
314
315 debugf( DEBUG_NAME "DNSServiceRegistrationAddRecord is currently not supported\n" );
316 return( 0 );
317 }
318
319 //===========================================================================================================================
320 // DNSServiceRegistrationUpdateRecord
321 //===========================================================================================================================
322
323 DNSServiceRegistrationReplyErrorType
324 DNSServiceRegistrationUpdateRecord(
325 dns_service_discovery_ref inRef,
326 DNSRecordReference inRecordRef,
327 uint16_t inRDLength,
328 const char * inRData,
329 uint32_t inTTL )
330 {
331 DNS_UNUSED( inRef );
332 DNS_UNUSED( inRecordRef );
333 DNS_UNUSED( inRDLength );
334 DNS_UNUSED( inRData );
335 DNS_UNUSED( inTTL );
336
337 debugf( DEBUG_NAME "DNSServiceRegistrationUpdateRecord is currently not supported\n" );
338 return( kDNSServiceDiscoveryUnsupportedErr );
339 }
340
341 //===========================================================================================================================
342 // DNSServiceRegistrationRemoveRecord
343 //===========================================================================================================================
344
345 DNSServiceRegistrationReplyErrorType
346 DNSServiceRegistrationRemoveRecord(
347 dns_service_discovery_ref inRef,
348 DNSRecordReference inRecordRef )
349 {
350 DNS_UNUSED( inRef );
351 DNS_UNUSED( inRecordRef );
352
353 debugf( DEBUG_NAME "DNSServiceRegistrationRemoveRecord is currently not supported\n" );
354 return( kDNSServiceDiscoveryUnsupportedErr );
355 }
356
357 //===========================================================================================================================
358 // DNSServiceDomainEnumerationCreate
359 //===========================================================================================================================
360
361 dns_service_discovery_ref
362 DNSServiceDomainEnumerationCreate(
363 int inRegistrationDomains,
364 DNSServiceDomainEnumerationReply inCallBack,
365 void * inContext )
366 {
367 DNSStatus err;
368 dns_service_discovery_ref result;
369 dns_service_discovery_ref obj;
370 DNSBrowserRef browser;
371 DNSBrowserFlags flags;
372
373 result = NULL;
374 browser = NULL;
375
376 // Allocate and initialize the object.
377
378 obj = (dns_service_discovery_ref) malloc( sizeof( *obj ) );
379 require_action( obj, exit, err = kDNSNoMemoryErr );
380
381 obj->type = kDNSServiceDiscoveryObjectTypeDomainEnumeration;
382 obj->ref = NULL;
383 obj->callback = inCallBack;
384 obj->context = inContext;
385
386 // Create the underlying browser and start searching for domains.
387
388 err = DNSBrowserCreate( 0, DNSServiceDomainEnumerationPrivateCallBack, obj, &browser );
389 require_noerr( err, exit );
390 obj->ref = browser;
391
392 if( inRegistrationDomains )
393 {
394 flags = kDNSBrowserFlagRegistrationDomainsOnly;
395 }
396 else
397 {
398 flags = 0;
399 }
400 err = DNSBrowserStartDomainSearch( browser, flags );
401 require_noerr( err, exit );
402
403 // Success!
404
405 result = obj;
406 browser = NULL;
407 obj = NULL;
408
409 exit:
410 if( browser )
411 {
412 DNSBrowserRelease( browser, 0 );
413 }
414 if( obj )
415 {
416 DNSServiceDiscoveryDeallocate( obj );
417 }
418 return( result );
419 }
420
421 //===========================================================================================================================
422 // DNSServiceDomainEnumerationPrivateCallBack
423 //===========================================================================================================================
424
425 DNS_LOCAL void
426 DNSServiceDomainEnumerationPrivateCallBack(
427 void * inContext,
428 DNSBrowserRef inRef,
429 DNSStatus inStatusCode,
430 const DNSBrowserEvent * inEvent )
431 {
432 dns_service_discovery_ref obj;
433 DNSServiceDomainEnumerationReply callback;
434
435 DNS_UNUSED( inRef );
436 DNS_UNUSED( inStatusCode );
437
438 check( inContext );
439 obj = (dns_service_discovery_ref) inContext;
440 check( obj->callback );
441 callback = (DNSServiceDomainEnumerationReply) obj->callback;
442
443 switch( inEvent->type )
444 {
445 case kDNSBrowserEventTypeAddDomain:
446 debugf( DEBUG_NAME "add domain \"%s\"\n", inEvent->data.addDomain.domain );
447
448 if( callback )
449 {
450 callback( DNSServiceDomainEnumerationReplyAddDomain, inEvent->data.addDomain.domain,
451 0, obj->context );
452 }
453 break;
454
455 case kDNSBrowserEventTypeAddDefaultDomain:
456 debugf( DEBUG_NAME "add default domain \"%s\"\n", inEvent->data.addDefaultDomain.domain );
457
458 if( callback )
459 {
460 callback( DNSServiceDomainEnumerationReplyAddDomainDefault, inEvent->data.addDefaultDomain.domain,
461 0, obj->context );
462 }
463 break;
464
465 case kDNSBrowserEventTypeRemoveDomain:
466 debugf( DEBUG_NAME "add default domain \"%s\"\n", inEvent->data.removeDomain.domain );
467
468 if( callback )
469 {
470 callback( DNSServiceDomainEnumerationReplyRemoveDomain, inEvent->data.removeDomain.domain,
471 0, obj->context );
472 }
473 break;
474
475 default:
476 break;
477 }
478 }
479
480 //===========================================================================================================================
481 // DNSServiceBrowserCreate
482 //===========================================================================================================================
483
484 dns_service_discovery_ref
485 DNSServiceBrowserCreate(
486 const char * inType,
487 const char * inDomain,
488 DNSServiceBrowserReply inCallBack,
489 void * inContext )
490 {
491 DNSStatus err;
492 dns_service_discovery_ref result;
493 dns_service_discovery_ref obj;
494 DNSBrowserRef browser;
495
496 result = NULL;
497 browser = NULL;
498
499 // Allocate and initialize the object.
500
501 obj = (dns_service_discovery_ref) malloc( sizeof( *obj ) );
502 require_action( obj, exit, err = kDNSNoMemoryErr );
503
504 obj->type = kDNSServiceDiscoveryObjectTypeBrowser;
505 obj->ref = NULL;
506 obj->callback = inCallBack;
507 obj->context = inContext;
508
509 // Create the underlying browser and start searching for domains.
510
511 err = DNSBrowserCreate( 0, DNSServiceBrowserPrivateCallBack, obj, &browser );
512 require_noerr( err, exit );
513 obj->ref = browser;
514
515 err = DNSBrowserStartServiceSearch( browser, 0, inType, inDomain );
516 require_noerr( err, exit );
517
518 // Success!
519
520 result = obj;
521 browser = NULL;
522 obj = NULL;
523
524 exit:
525 if( browser )
526 {
527 DNSBrowserRelease( browser, 0 );
528 }
529 if( obj )
530 {
531 DNSServiceDiscoveryDeallocate( obj );
532 }
533 return( result );
534 }
535
536 //===========================================================================================================================
537 // DNSServiceBrowserPrivateCallBack
538 //===========================================================================================================================
539
540 DNS_LOCAL void
541 DNSServiceBrowserPrivateCallBack(
542 void * inContext,
543 DNSBrowserRef inRef,
544 DNSStatus inStatusCode,
545 const DNSBrowserEvent * inEvent )
546 {
547 dns_service_discovery_ref obj;
548 DNSServiceBrowserReply callback;
549
550 DNS_UNUSED( inRef );
551 DNS_UNUSED( inStatusCode );
552
553 check( inContext );
554 obj = (dns_service_discovery_ref) inContext;
555 check( obj->callback );
556 callback = (DNSServiceBrowserReply) obj->callback;
557
558 switch( inEvent->type )
559 {
560 case kDNSBrowserEventTypeAddService:
561 debugf( DEBUG_NAME "add service \"%s.%s%s\"\n",
562 inEvent->data.addService.name,
563 inEvent->data.addService.type,
564 inEvent->data.addService.domain );
565
566 if( callback )
567 {
568 callback( DNSServiceBrowserReplyAddInstance,
569 inEvent->data.addService.name,
570 inEvent->data.addService.type,
571 inEvent->data.addService.domain,
572 0,
573 obj->context );
574 }
575 break;
576
577 case kDNSBrowserEventTypeRemoveService:
578 debugf( DEBUG_NAME "remove service \"%s.%s%s\"\n",
579 inEvent->data.removeService.name,
580 inEvent->data.removeService.type,
581 inEvent->data.removeService.domain );
582
583 if( callback )
584 {
585 callback( DNSServiceBrowserReplyRemoveInstance,
586 inEvent->data.removeService.name,
587 inEvent->data.removeService.type,
588 inEvent->data.removeService.domain,
589 0,
590 obj->context );
591 }
592 break;
593
594 default:
595 break;
596 }
597 }
598
599 //===========================================================================================================================
600 // DNSServiceResolverResolve
601 //===========================================================================================================================
602
603 dns_service_discovery_ref
604 DNSServiceResolverResolve(
605 const char * inName,
606 const char * inType,
607 const char * inDomain,
608 DNSServiceResolverReply inCallBack,
609 void * inContext )
610 {
611 DNSStatus err;
612 dns_service_discovery_ref result;
613 dns_service_discovery_ref obj;
614 DNSResolverRef resolver;
615
616 result = NULL;
617
618 // Allocate and initialize the object.
619
620 obj = (dns_service_discovery_ref) malloc( sizeof( *obj ) );
621 require_action( obj, exit, err = kDNSNoMemoryErr );
622
623 obj->type = kDNSServiceDiscoveryObjectTypeResolver;
624 obj->ref = NULL;
625 obj->callback = inCallBack;
626 obj->context = inContext;
627
628 // Create the underlying resolver and start searching for domains.
629
630 err = DNSResolverCreate( 0, inName, inType, inDomain, DNSServiceResolverPrivateCallBack, obj, NULL, &resolver );
631 require_noerr( err, exit );
632 obj->ref = resolver;
633
634 // Success!
635
636 result = obj;
637 obj = NULL;
638
639 exit:
640 if( obj )
641 {
642 DNSServiceDiscoveryDeallocate( obj );
643 }
644 return( result );
645 }
646
647 //===========================================================================================================================
648 // DNSServiceResolverPrivateCallBack
649 //===========================================================================================================================
650
651 DNS_LOCAL void
652 DNSServiceResolverPrivateCallBack(
653 void * inContext,
654 DNSResolverRef inRef,
655 DNSStatus inStatusCode,
656 const DNSResolverEvent * inEvent )
657 {
658 dns_service_discovery_ref obj;
659 DNSServiceResolverReply callback;
660 struct sockaddr_in interfaceAddr;
661 struct sockaddr_in addr;
662
663 DNS_UNUSED( inRef );
664 DNS_UNUSED( inStatusCode );
665
666 check( inContext );
667 obj = (dns_service_discovery_ref) inContext;
668 check( obj->callback );
669 callback = (DNSServiceResolverReply) obj->callback;
670
671 switch( inEvent->type )
672 {
673 case kDNSResolverEventTypeResolved:
674 debugf( DEBUG_NAME "resolved \"%s.%s%s\"\n",
675 inEvent->data.resolved.name,
676 inEvent->data.resolved.type,
677 inEvent->data.resolved.domain );
678
679 memset( &interfaceAddr, 0, sizeof( interfaceAddr ) );
680 interfaceAddr.sin_family = AF_INET;
681 interfaceAddr.sin_port = 0;
682 interfaceAddr.sin_addr.s_addr = inEvent->data.resolved.interfaceIP.u.ipv4.addr.v32;
683
684 memset( &addr, 0, sizeof( addr ) );
685 addr.sin_family = AF_INET;
686 addr.sin_port = inEvent->data.resolved.address.u.ipv4.port.v16;
687 addr.sin_addr.s_addr = inEvent->data.resolved.address.u.ipv4.addr.v32;
688
689 if( callback )
690 {
691 callback( (struct sockaddr *) &interfaceAddr, (struct sockaddr *) &addr, inEvent->data.resolved.textRecord,
692 0, obj->context );
693 }
694 break;
695
696 default:
697 break;
698 }
699 }
700
701 //===========================================================================================================================
702 // DNSServiceDiscoveryMachPort
703 //===========================================================================================================================
704
705 mach_port_t DNSServiceDiscoveryMachPort( dns_service_discovery_ref inRef )
706 {
707 DNS_UNUSED( inRef );
708
709 debugf( DEBUG_NAME "DNSServiceDiscoveryMachPort is not supported\n" );
710 return( 0 );
711 }
712
713 //===========================================================================================================================
714 // DNSServiceDiscoveryDeallocate
715 //===========================================================================================================================
716
717 void DNSServiceDiscoveryDeallocate( dns_service_discovery_ref inRef )
718 {
719 _dns_service_discovery_t * obj;
720 DNSStatus err;
721
722 check( inRef );
723 check( inRef->ref );
724
725 obj = (_dns_service_discovery_t *) inRef;
726 switch( obj->type )
727 {
728 case kDNSServiceDiscoveryObjectTypeRegistration:
729 if( inRef->ref )
730 {
731 err = DNSRegistrationRelease( (DNSRegistrationRef) inRef->ref, 0 );
732 check_noerr( err );
733 }
734 free( inRef );
735 break;
736
737 case kDNSServiceDiscoveryObjectTypeDomainEnumeration:
738 if( inRef->ref )
739 {
740 err = DNSBrowserRelease( (DNSBrowserRef) inRef->ref, 0 );
741 check_noerr( err );
742 }
743 free( inRef );
744 break;
745
746 case kDNSServiceDiscoveryObjectTypeBrowser:
747 if( inRef->ref )
748 {
749 err = DNSBrowserRelease( (DNSBrowserRef) inRef->ref, 0 );
750 check_noerr( err );
751 }
752 free( inRef );
753 break;
754
755 case kDNSServiceDiscoveryObjectTypeResolver:
756 if( inRef->ref )
757 {
758 err = DNSResolverRelease( (DNSResolverRef) inRef->ref, 0 );
759 check_noerr( err );
760 }
761 free( inRef );
762 break;
763
764 default:
765 debugf( DEBUG_NAME "unknown object type (%d)\n", obj->type );
766 break;
767 }
768 }
769
770 //===========================================================================================================================
771 // DNSServiceDiscovery_handleReply
772 //===========================================================================================================================
773
774 void DNSServiceDiscovery_handleReply( void *inReplyMessage )
775 {
776 DNS_UNUSED( inReplyMessage );
777
778 debugf( DEBUG_NAME "DNSServiceDiscovery_handleReply is not supported\n" );
779 }
780
781 #ifdef __cplusplus
782 }
783 #endif