Bonjour/MYAddressLookup.h
author Dan Preston <danpreston@codechemistry.com>
Tue May 05 15:12:18 2009 -0700 (2009-05-05)
changeset 39 5ed02247b7fc
parent 28 732576fa8a0d
child 50 63baa74c903f
permissions -rw-r--r--
Enabled garbage collection as being supported in the library target.
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@28
    10
jens@28
    11
jens@28
    12
/** An asynchronous DNS address lookup. Supports both Bonjour services and traditional hostnames. */
jens@28
    13
@interface MYAddressLookup : MYDNSService
jens@28
    14
{
jens@28
    15
    NSString *_hostname;
jens@28
    16
    UInt16 _interfaceIndex;
jens@28
    17
    NSMutableSet *_addresses;
jens@28
    18
    UInt16 _port;
jens@28
    19
    CFAbsoluteTime _expires;
jens@28
    20
}
jens@28
    21
jens@31
    22
/** Initializes the lookup with a DNS hostname.
jens@31
    23
    (If you've got a Bonjour service already, as a MYBonjourService object, it's more convenient
jens@31
    24
    to access its addressLookup property instead of creating your own instance.) */
jens@28
    25
- (id) initWithHostname: (NSString*)hostname;
jens@28
    26
jens@28
    27
/** The port number; this will be copied into the resulting IPAddress objects.
jens@28
    28
    Defaults to zero, but you can set it before calling -start. */
jens@28
    29
@property UInt16 port;
jens@28
    30
jens@31
    31
/** The index of the network interface to use, or zero (the default) for any interface.
jens@31
    32
    You usually don't need to set this. */
jens@28
    33
@property UInt16 interfaceIndex;
jens@28
    34
jens@28
    35
/** The resulting address(es) of the host, as HostAddress objects. */
jens@28
    36
@property (readonly) NSSet *addresses;
jens@28
    37
jens@28
    38
/** How much longer the addresses will remain valid.
jens@28
    39
    If the value is zero, the addresses are no longer valid, and you should instead
jens@28
    40
    call -start again and wait for the 'addresses' property to update.
jens@28
    41
    If you set the service to continuous mode, addresses will never expire since the
jens@28
    42
    query will continue to update them. */
jens@28
    43
@property (readonly) NSTimeInterval timeToLive;
jens@28
    44
jens@28
    45
@end