Rewrote the Bonjour classes, using the low-level <dns_sd.h> API. They're now subclasses of MYDNSService.
5 // Created by Jens Alfke on 4/23/09.
6 // Copyright 2009 Jens Alfke. All rights reserved.
9 #import <Foundation/Foundation.h>
10 #import <CoreFoundation/CFSocket.h>
13 /** Abstract superclass for services based on DNSServiceRefs, such as MYPortMapper. */
14 @interface MYDNSService : NSObject
17 struct _DNSServiceRef_t *_serviceRef;
19 CFRunLoopSourceRef _socketSource;
24 /** If NO (the default), the service will stop after it gets a result.
25 If YES, it will continue to run until stopped. */
26 @property BOOL continuous;
28 /** Starts the service.
29 Returns immediately; you can find out when the service actually starts (or fails to)
30 by observing the isOpen and error properties.
31 It's very unlikely that this call itself will fail (return NO). If it does, it
32 probably means that the mDNSResponder process isn't working. */
35 /** Stops the service. */
39 /** The error status, a DNSServiceErrorType enum; nonzero if something went wrong.
40 This property is KV observable. */
41 @property int32_t error;
45 /** Subclass must implement this abstract method to create a new DNSServiceRef.
46 This method is called by -open.
47 If an error occurs, the method should set self.error and return NULL.*/
48 - (struct _DNSServiceRef_t*) createServiceRef;
50 @property (readonly) struct _DNSServiceRef_t* serviceRef;
52 /** Same as -stop, but does not clear the error property.
53 (The stop method actually calls this first.) */
56 /** Block until a message is received from the daemon.
57 This will cause the service's callback (defined by the subclass) to be invoked.
58 @return YES if a message is received, NO on error (or if the service isn't started) */
59 - (BOOL) waitForReply;