Merged Jens' latest changes.
5 // Created by Jens Alfke on 1/22/08.
6 // Copyright 2008 Jens Alfke. All rights reserved.
9 #import "MYDNSService.h"
10 @class MYBonjourQuery, MYAddressLookup;
13 /** Represents a Bonjour service discovered by a MYBonjourBrowser. */
14 @interface MYBonjourService : MYDNSService
17 NSString *_name, *_fullName, *_type, *_domain, *_hostname;
18 uint32_t _interfaceIndex;
21 NSDictionary *_txtRecord;
22 MYBonjourQuery *_txtQuery;
23 MYAddressLookup *_addressLookup;
26 /** The service's name. */
27 @property (readonly) NSString *name;
29 /** The service's type. */
30 @property (readonly) NSString *type;
32 /** The service's domain. */
33 @property (readonly) NSString *domain;
35 /** The service's full name -- the name, type and domain concatenated together. */
36 @property (readonly,copy) NSString* fullName;
38 /** The index of the network interface on which this service was found. */
39 @property (readonly) uint32_t interfaceIndex;
43 * Getting the IP address of the service
47 /** The hostname of the machine providing this service. */
48 @property (readonly, copy) NSString *hostname;
50 /** The IP port number of this service on its host. */
51 @property (readonly) UInt16 port;
53 /** Returns a MYDNSLookup object that resolves the raw IP address(es) of this service.
54 Subsequent calls to this method will always return the same object. */
55 - (MYAddressLookup*) addressLookup;
60 /** @name TXT and other DNS records
64 /** The service's metadata dictionary, from its DNS TXT record */
65 @property (readonly,copy) NSDictionary *txtRecord;
67 /** A convenience to access a single property from the TXT record. */
68 - (NSString*) txtStringForKey: (NSString*)key;
70 /** Starts a new MYBonjourQuery for the specified DNS record type of this service.
71 @param recordType The DNS record type, e.g. kDNSServiceType_TXT; see the enum in <dns_sd.h>. */
72 - (MYBonjourQuery*) queryForRecord: (UInt16)recordType;
78 * Advanced methods that may be overridden by subclasses, but should not be called directly.
82 /** Designated initializer. You probably don't want to create MYBonjourService instances yourself,
83 but if you subclass you might need to override this initializer. */
84 - (id) initWithName: (NSString*)serviceName
86 domain: (NSString*)domain
87 interface: (UInt32)interfaceIndex;
89 /** Called when this service is officially added to its browser's service set.
90 You can override this, but be sure to call the superclass method. */
93 /** Called when this service is officially removed to its browser's service set.
94 You can override this, but be sure to call the superclass method. */
97 /** Called when this service's TXT record changes.
98 You can override this, but be sure to call the superclass method. */
99 - (void) txtRecordChanged;
101 /** Called when a query started by this service updates.
102 You can override this, but be sure to call the superclass method. */
103 - (void) queryDidUpdate: (MYBonjourQuery*)query;