Yuck -- [TCPConnection initToBonjourService:] was releasing the wrong object, the BonjourService, causing it to dealloc and eventually crash. Fixes #10.
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 /** The service's full name -- the name, type and domain concatenated together. */
37 @property (readonly,copy) NSString* fullName;
39 /** The index of the network interface on which this service was found. */
40 @property (readonly) uint32_t interfaceIndex;
44 * Getting the IP address of the service
48 /** The hostname of the machine providing this service. */
49 @property (readonly, copy) NSString *hostname;
51 /** The IP port number of this service on its host. */
52 @property (readonly) UInt16 port;
54 /** Returns a MYDNSLookup object that resolves the raw IP address(es) of this service.
55 Subsequent calls to this method will always return the same object. */
56 - (MYAddressLookup*) addressLookup;
61 /** @name TXT and other DNS records
65 /** The service's metadata dictionary, from its DNS TXT record */
66 @property (readonly,copy) NSDictionary *txtRecord;
68 /** A convenience to access a single property from the TXT record. */
69 - (NSString*) txtStringForKey: (NSString*)key;
71 /** Starts a new MYBonjourQuery for the specified DNS record type of this service.
72 @param recordType The DNS record type, e.g. kDNSServiceType_TXT; see the enum in <dns_sd.h>. */
73 - (MYBonjourQuery*) queryForRecord: (UInt16)recordType;
79 * Advanced methods that may be overridden by subclasses, but should not be called directly.
83 /** Designated initializer. You probably don't want to create MYBonjourService instances yourself,
84 but if you subclass you might need to override this initializer. */
85 - (id) initWithName: (NSString*)serviceName
87 domain: (NSString*)domain
88 interface: (UInt32)interfaceIndex;
90 /** Called when this service is officially added to its browser's service set.
91 You can override this, but be sure to call the superclass method. */
94 /** Called when this service is officially removed to its browser's service set.
95 You can override this, but be sure to call the superclass method. */
98 /** Called when this service's TXT record changes.
99 You can override this, but be sure to call the superclass method. */
100 - (void) txtRecordChanged;
102 /** Called when a query started by this service updates.
103 You can override this, but be sure to call the superclass method. */
104 - (void) queryDidUpdate: (MYBonjourQuery*)query;