Bonjour/MYBonjourBrowser.h
author Jens Alfke <jens@mooseyard.com>
Fri Apr 24 10:10:32 2009 -0700 (2009-04-24)
changeset 27 92581f26073e
child 28 732576fa8a0d
permissions -rw-r--r--
* Refactored MYPortMapper to use a new abstract base class MYDNSService; that way I can re-use it later for implementing Bonjour.
* Fixed issue #1: a memory leak in BLIPProperties, reported by codechemist.
     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 <Foundation/Foundation.h>
    10 
    11 
    12 /** Searches for Bonjour services of a specific type. */
    13 @interface MYBonjourBrowser : NSObject
    14 {
    15     @private
    16     NSString *_serviceType;
    17     NSNetServiceBrowser *_browser;
    18     BOOL _browsing;
    19     NSError *_error;
    20     Class _serviceClass;
    21     NSMutableSet *_services, *_addServices, *_rmvServices;
    22 }
    23 
    24 /** Initializes a new BonjourBrowser.
    25     Call -start to begin browsing.
    26     @param serviceType  The name of the service type to look for, e.g. "_http._tcp". */
    27 - (id) initWithServiceType: (NSString*)serviceType;
    28 
    29 /** Starts browsing. This is asynchronous, so nothing will happen immediately. */
    30 - (void) start;
    31 
    32 /** Stops browsing. */
    33 - (void) stop;
    34 
    35 /** Is the browser currently browsing? */
    36 @property (readonly) BOOL browsing;
    37 
    38 /** The current error status, if any.
    39     This is KV-observable. */
    40 @property (readonly,retain) NSError* error;
    41 
    42 /** The set of currently found services. These are instances of the serviceClass,
    43     which is BonjourService by default.
    44     This is KV-observable. */
    45 @property (readonly) NSSet *services;
    46 
    47 /** The class of objects to create to represent services.
    48     The default value is [BonjourService class]; you can change this, but only
    49     to a subclass of that. */
    50 @property Class serviceClass;
    51 
    52 @end