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