Bonjour/MYBonjourBrowser.h
author Jens Alfke <jens@mooseyard.com>
Fri Jul 24 14:06:28 2009 -0700 (2009-07-24)
changeset 63 5e4855a592ee
parent 50 63baa74c903f
permissions -rw-r--r--
* The BLIPConnection receivedRequest: delegate method now returns BOOL. If the method returns NO (or if the method isn't implemented in the delegate), that means it didn't handle the message at all; an error will be returned to the sender.
* If the connection closes unexpectedly due to an error, then the auto-generated responses to pending requests will contain that error. This makes it easier to display a meaningful error message in the handler for the request.
     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     id _delegate;
    24 }
    25 
    26 /** Initializes a new MYBonjourBrowser.
    27     Call -start to begin browsing.
    28     @param serviceType  The name of the service type to look for, e.g. "_http._tcp". */
    29 - (id) initWithServiceType: (NSString*)serviceType;
    30 
    31 @property (assign) id delegate;
    32 
    33 /** Is the browser currently browsing? */
    34 @property (readonly) BOOL browsing;
    35 
    36 /** The set of currently found services. These are instances of the serviceClass,
    37     which is MYBonjourService by default.
    38     This is KV-observable. */
    39 @property (readonly) NSSet *services;
    40 
    41 /** The class of objects to create to represent services.
    42     The default value is [MYBonjourService class]; you can change this, but only
    43     to a subclass of that. */
    44 @property Class serviceClass;
    45 
    46 /** My own registration for this service type.
    47     This object is created on demand and won't be started up until you tell it to.
    48     Before starting it, you'll need to set its port, and optionally its name.
    49     Your own registration will _not_ be visible in the set of services.*/
    50 @property (readonly) MYBonjourRegistration *myRegistration;
    51 
    52 @end