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