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.
jens@26
     1
//
jens@26
     2
//  MYBonjourBrowser.h
jens@26
     3
//  MYNetwork
jens@26
     4
//
jens@26
     5
//  Created by Jens Alfke on 1/22/08.
jens@26
     6
//  Copyright 2008 Jens Alfke. All rights reserved.
jens@26
     7
//
jens@26
     8
jens@26
     9
#import <Foundation/Foundation.h>
jens@26
    10
jens@26
    11
jens@26
    12
/** Searches for Bonjour services of a specific type. */
jens@26
    13
@interface MYBonjourBrowser : NSObject
jens@26
    14
{
jens@26
    15
    @private
jens@26
    16
    NSString *_serviceType;
jens@26
    17
    NSNetServiceBrowser *_browser;
jens@26
    18
    BOOL _browsing;
jens@26
    19
    NSError *_error;
jens@26
    20
    Class _serviceClass;
jens@26
    21
    NSMutableSet *_services, *_addServices, *_rmvServices;
jens@26
    22
}
jens@26
    23
jens@26
    24
/** Initializes a new BonjourBrowser.
jens@26
    25
    Call -start to begin browsing.
jens@26
    26
    @param serviceType  The name of the service type to look for, e.g. "_http._tcp". */
jens@26
    27
- (id) initWithServiceType: (NSString*)serviceType;
jens@26
    28
jens@26
    29
/** Starts browsing. This is asynchronous, so nothing will happen immediately. */
jens@26
    30
- (void) start;
jens@26
    31
jens@26
    32
/** Stops browsing. */
jens@26
    33
- (void) stop;
jens@26
    34
jens@26
    35
/** Is the browser currently browsing? */
jens@26
    36
@property (readonly) BOOL browsing;
jens@26
    37
jens@26
    38
/** The current error status, if any.
jens@26
    39
    This is KV-observable. */
jens@26
    40
@property (readonly,retain) NSError* error;
jens@26
    41
jens@26
    42
/** The set of currently found services. These are instances of the serviceClass,
jens@26
    43
    which is BonjourService by default.
jens@26
    44
    This is KV-observable. */
jens@26
    45
@property (readonly) NSSet *services;
jens@26
    46
jens@26
    47
/** The class of objects to create to represent services.
jens@26
    48
    The default value is [BonjourService class]; you can change this, but only
jens@26
    49
    to a subclass of that. */
jens@26
    50
@property Class serviceClass;
jens@26
    51
jens@26
    52
@end