jens@26: // jens@26: // MYBonjourService.h jens@26: // MYNetwork jens@26: // jens@26: // Created by Jens Alfke on 1/22/08. jens@26: // Copyright 2008 Jens Alfke. All rights reserved. jens@26: // jens@26: jens@28: #import "MYDNSService.h" jens@26: #import "ConcurrentOperation.h" jens@28: @class MYBonjourQuery, MYAddressLookup; jens@26: jens@26: jens@26: /** Represents a Bonjour service discovered by a BonjourBrowser. */ jens@28: @interface MYBonjourService : MYDNSService jens@26: { jens@26: @private jens@28: NSString *_name, *_fullName, *_type, *_domain, *_hostname; jens@28: uint32_t _interfaceIndex; jens@28: BOOL _startedResolve; jens@28: UInt16 _port; jens@26: NSDictionary *_txtRecord; jens@28: MYBonjourQuery *_txtQuery; jens@28: MYAddressLookup *_addressLookup; jens@26: } jens@26: jens@26: /** The service's name. */ jens@26: @property (readonly) NSString *name; jens@26: jens@28: /** The service's type. */ jens@28: @property (readonly) NSString *type; jens@28: jens@28: /** The service's domain. */ jens@28: @property (readonly) NSString *domain; jens@28: jens@28: @property (readonly, copy) NSString *hostname; jens@28: jens@28: @property (readonly) UInt16 port; jens@28: jens@28: @property (readonly) uint32_t interfaceIndex; jens@28: jens@28: @property (readonly,copy) NSString* fullName; jens@28: jens@26: /** The service's metadata dictionary, from its DNS TXT record */ jens@26: @property (readonly,copy) NSDictionary *txtRecord; jens@26: jens@26: /** A convenience to access a single property from the TXT record. */ jens@26: - (NSString*) txtStringForKey: (NSString*)key; jens@26: jens@28: /** Returns a MYDNSLookup object that resolves the IP address(es) of this service. jens@28: Subsequent calls to this method will always return the same object. */ jens@28: - (MYAddressLookup*) addressLookup; jens@26: jens@28: /** Starts a new MYBonjourQuery for the specified DNS record type of this service. jens@28: @param recordType The DNS record type, e.g. kDNSServiceType_TXT; see the enum in . */ jens@28: - (MYBonjourQuery*) queryForRecord: (UInt16)recordType; jens@26: jens@26: jens@26: // Protected methods, for subclass use only: jens@26: jens@28: // (for subclasses to override, but not call): jens@28: - (id) initWithName: (NSString*)serviceName jens@28: type: (NSString*)type jens@28: domain: (NSString*)domain jens@28: interface: (uint32_t)interfaceIndex; jens@26: jens@26: - (void) added; jens@26: - (void) removed; jens@26: - (void) txtRecordChanged; jens@26: jens@28: // Internal: jens@28: jens@28: - (void) queryDidUpdate: (MYBonjourQuery*)query; jens@28: jens@26: @end jens@26: jens@26: jens@26: jens@26: @interface MYBonjourResolveOperation : ConcurrentOperation jens@26: { jens@26: MYBonjourService *_service; jens@26: NSSet *_addresses; jens@26: } jens@26: jens@26: @property (readonly) MYBonjourService *service; jens@26: @property (readonly,retain) NSSet *addresses; jens@26: jens@26: @end