Rewrote the Bonjour classes, using the low-level <dns_sd.h> API. They're now subclasses of MYDNSService.
5 // Created by Jens Alfke on 1/22/08.
6 // Copyright 2008 Jens Alfke. All rights reserved.
9 #import "MYDNSService.h"
10 #import "ConcurrentOperation.h"
11 @class MYBonjourQuery, MYAddressLookup;
14 /** Represents a Bonjour service discovered by a BonjourBrowser. */
15 @interface MYBonjourService : MYDNSService
18 NSString *_name, *_fullName, *_type, *_domain, *_hostname;
19 uint32_t _interfaceIndex;
22 NSDictionary *_txtRecord;
23 MYBonjourQuery *_txtQuery;
24 MYAddressLookup *_addressLookup;
27 /** The service's name. */
28 @property (readonly) NSString *name;
30 /** The service's type. */
31 @property (readonly) NSString *type;
33 /** The service's domain. */
34 @property (readonly) NSString *domain;
36 @property (readonly, copy) NSString *hostname;
38 @property (readonly) UInt16 port;
40 @property (readonly) uint32_t interfaceIndex;
42 @property (readonly,copy) NSString* fullName;
44 /** The service's metadata dictionary, from its DNS TXT record */
45 @property (readonly,copy) NSDictionary *txtRecord;
47 /** A convenience to access a single property from the TXT record. */
48 - (NSString*) txtStringForKey: (NSString*)key;
50 /** Returns a MYDNSLookup object that resolves the IP address(es) of this service.
51 Subsequent calls to this method will always return the same object. */
52 - (MYAddressLookup*) addressLookup;
54 /** Starts a new MYBonjourQuery for the specified DNS record type of this service.
55 @param recordType The DNS record type, e.g. kDNSServiceType_TXT; see the enum in <dns_sd.h>. */
56 - (MYBonjourQuery*) queryForRecord: (UInt16)recordType;
59 // Protected methods, for subclass use only:
61 // (for subclasses to override, but not call):
62 - (id) initWithName: (NSString*)serviceName
64 domain: (NSString*)domain
65 interface: (uint32_t)interfaceIndex;
69 - (void) txtRecordChanged;
73 - (void) queryDidUpdate: (MYBonjourQuery*)query;
79 @interface MYBonjourResolveOperation : ConcurrentOperation
81 MYBonjourService *_service;
85 @property (readonly) MYBonjourService *service;
86 @property (readonly,retain) NSSet *addresses;