1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/PortMapper/MYDNSService.h Sun Apr 26 18:12:44 2009 -0700
1.3 @@ -0,0 +1,48 @@
1.4 +//
1.5 +// MYDNSService.h
1.6 +// MYNetwork
1.7 +//
1.8 +// Created by Jens Alfke on 4/23/09.
1.9 +// Copyright 2009 Jens Alfke. All rights reserved.
1.10 +//
1.11 +
1.12 +#import <Foundation/Foundation.h>
1.13 +#import <CoreFoundation/CFSocket.h>
1.14 +
1.15 +
1.16 +/** Abstract superclass for services based on DNSServiceRefs, such as MYPortMapper. */
1.17 +@interface MYDNSService : NSObject
1.18 +{
1.19 + @private
1.20 + struct _DNSServiceRef_t *_serviceRef;
1.21 + CFSocketRef _socket;
1.22 + CFRunLoopSourceRef _socketSource;
1.23 + SInt32 _error;
1.24 +}
1.25 +
1.26 +/** Starts the service.
1.27 + Returns immediately; you can find out when the service actually starts (or fails to)
1.28 + by observing the isOpen and error properties.
1.29 + It's very unlikely that this call itself will fail (return NO). If it does, it
1.30 + probably means that the mDNSResponder process isn't working. */
1.31 +- (BOOL) open;
1.32 +
1.33 +- (void) close;
1.34 +
1.35 +
1.36 +@property (readonly) struct _DNSServiceRef_t* serviceRef;
1.37 +
1.38 +/** The error status, a DNSServiceErrorType enum; nonzero if something went wrong.
1.39 + This property is KV observable. */
1.40 +@property SInt32 error;
1.41 +
1.42 +// PROTECTED:
1.43 +
1.44 +/** Subclass must implement this abstract method to create a new DNSServiceRef.
1.45 + This method is called by -open.
1.46 + If an error occurs, the method should set self.error and return NULL.*/
1.47 +- (struct _DNSServiceRef_t*) createServiceRef;
1.48 +
1.49 +- (void) stopService;
1.50 +
1.51 +@end