Bonjour/MYBonjourBrowser.h
author Jens Alfke <jens@mooseyard.com>
Sun May 10 19:00:50 2009 -0700 (2009-05-10)
changeset 45 8efb48eabd08
parent 28 732576fa8a0d
child 50 63baa74c903f
permissions -rw-r--r--
Fixed MYAddressLookup to allocate an NSSet, and to send correct KV notifications. (Based on Jim Roepke's patch, but outsourcing the KV grunge to CollectionUtils.)
     1 //
     2 //  MYBonjourBrowser.h
     3 //  MYNetwork
     4 //
     5 //  Created by Jens Alfke on 1/22/08.
     6 //  Copyright 2008 Jens Alfke. All rights reserved.
     7 //
     8 
     9 #import "MYDNSService.h"
    10 @class MYBonjourRegistration;
    11 
    12 
    13 /** Searches for Bonjour services of a specific type. */
    14 @interface MYBonjourBrowser : MYDNSService
    15 {
    16     @private
    17     NSString *_serviceType;
    18     BOOL _browsing;
    19     Class _serviceClass;
    20     NSMutableSet *_services, *_addServices, *_rmvServices;
    21     BOOL _pendingUpdate;
    22     MYBonjourRegistration *_myRegistration;
    23 }
    24 
    25 /** Initializes a new BonjourBrowser.
    26     Call -start to begin browsing.
    27     @param serviceType  The name of the service type to look for, e.g. "_http._tcp". */
    28 - (id) initWithServiceType: (NSString*)serviceType;
    29 
    30 /** Is the browser currently browsing? */
    31 @property (readonly) BOOL browsing;
    32 
    33 /** The set of currently found services. These are instances of the serviceClass,
    34     which is BonjourService by default.
    35     This is KV-observable. */
    36 @property (readonly) NSSet *services;
    37 
    38 /** The class of objects to create to represent services.
    39     The default value is [BonjourService class]; you can change this, but only
    40     to a subclass of that. */
    41 @property Class serviceClass;
    42 
    43 /** My own registration for this service type.
    44     This object is created on demand and won't be started up until you tell it to.
    45     Before starting it, you'll need to set its port, and optionally its name.
    46     Your own registration will _not_ be visible in the set of services.*/
    47 @property (readonly) MYBonjourRegistration *myRegistration;
    48 
    49 @end