Bonjour/MYAddressLookup.h
author Jens Alfke <jens@mooseyard.com>
Fri Jul 24 14:06:28 2009 -0700 (2009-07-24)
changeset 63 5e4855a592ee
parent 31 1d6924779df7
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.
jens@28
     1
//
jens@28
     2
//  MYAddressLookup.h
jens@28
     3
//  MYNetwork
jens@28
     4
//
jens@28
     5
//  Created by Jens Alfke on 4/24/09.
jens@28
     6
//  Copyright 2009 Jens Alfke. All rights reserved.
jens@28
     7
//
jens@28
     8
jens@28
     9
#import "MYDNSService.h"
jens@50
    10
@class MYBonjourService;
jens@28
    11
jens@28
    12
jens@28
    13
/** An asynchronous DNS address lookup. Supports both Bonjour services and traditional hostnames. */
jens@28
    14
@interface MYAddressLookup : MYDNSService
jens@28
    15
{
jens@50
    16
    MYBonjourService *_service;
jens@28
    17
    NSString *_hostname;
jens@28
    18
    UInt16 _interfaceIndex;
jens@28
    19
    NSMutableSet *_addresses;
jens@28
    20
    UInt16 _port;
jens@28
    21
    CFAbsoluteTime _expires;
jens@28
    22
}
jens@28
    23
jens@31
    24
/** Initializes the lookup with a DNS hostname.
jens@31
    25
    (If you've got a Bonjour service already, as a MYBonjourService object, it's more convenient
jens@31
    26
    to access its addressLookup property instead of creating your own instance.) */
jens@28
    27
- (id) initWithHostname: (NSString*)hostname;
jens@28
    28
jens@50
    29
@property (readonly, copy) NSString *hostname;
jens@50
    30
jens@28
    31
/** The port number; this will be copied into the resulting IPAddress objects.
jens@28
    32
    Defaults to zero, but you can set it before calling -start. */
jens@28
    33
@property UInt16 port;
jens@28
    34
jens@31
    35
/** The index of the network interface to use, or zero (the default) for any interface.
jens@31
    36
    You usually don't need to set this. */
jens@28
    37
@property UInt16 interfaceIndex;
jens@28
    38
jens@28
    39
/** The resulting address(es) of the host, as HostAddress objects. */
jens@28
    40
@property (readonly) NSSet *addresses;
jens@28
    41
jens@28
    42
/** How much longer the addresses will remain valid.
jens@28
    43
    If the value is zero, the addresses are no longer valid, and you should instead
jens@28
    44
    call -start again and wait for the 'addresses' property to update.
jens@28
    45
    If you set the service to continuous mode, addresses will never expire since the
jens@28
    46
    query will continue to update them. */
jens@28
    47
@property (readonly) NSTimeInterval timeToLive;
jens@28
    48
jens@50
    49
jens@50
    50
//internal:
jens@50
    51
- (id) _initWithBonjourService: (MYBonjourService*)service;
jens@50
    52
- (void) _serviceGotResponse;
jens@50
    53
jens@28
    54
@end