* Refactored MYPortMapper to use a new abstract base class MYDNSService; that way I can re-use it later for implementing Bonjour.
* Fixed issue #1: a memory leak in BLIPProperties, reported by codechemist.
5 // Created by Jens Alfke on 1/22/08.
6 // Copyright 2008 Jens Alfke. All rights reserved.
9 #import <Foundation/Foundation.h>
10 #import "ConcurrentOperation.h"
11 @class MYBonjourResolveOperation;
14 /** Represents a Bonjour service discovered by a BonjourBrowser. */
15 @interface MYBonjourService : NSObject
18 NSNetService *_netService;
19 NSDictionary *_txtRecord;
21 CFAbsoluteTime _addressesExpireAt;
22 MYBonjourResolveOperation *_resolveOp;
25 /** The service's name. */
26 @property (readonly) NSString *name;
28 /** The service's metadata dictionary, from its DNS TXT record */
29 @property (readonly,copy) NSDictionary *txtRecord;
31 /** A convenience to access a single property from the TXT record. */
32 - (NSString*) txtStringForKey: (NSString*)key;
34 /** Returns a set of IPAddress objects; may be the empty set if address resolution failed,
35 or nil if addresses have not been resolved yet (or expired).
36 In the latter case, call -resolve and wait for the returned Operation to finish. */
37 @property (readonly,copy) NSSet* addresses;
39 /** Starts looking up the IP address(es) of this service.
40 @return The NSOperation representing the lookup; you can observe this to see when it
41 completes, or you can observe the service's 'addresses' property. */
42 - (MYBonjourResolveOperation*) resolve;
44 /** The underlying NSNetSerice object. */
45 @property (readonly) NSNetService *netService;
48 // Protected methods, for subclass use only:
50 - (id) initWithNetService: (NSNetService*)netService;
52 // (for subclasses to override, but not call):
55 - (void) txtRecordChanged;
61 @interface MYBonjourResolveOperation : ConcurrentOperation
63 MYBonjourService *_service;
67 @property (readonly) MYBonjourService *service;
68 @property (readonly,retain) NSSet *addresses;