Bonjour/MYAddressLookup.h
author Jens Alfke <jens@mooseyard.com>
Mon Apr 27 09:03:56 2009 -0700 (2009-04-27)
changeset 28 732576fa8a0d
child 31 1d6924779df7
permissions -rw-r--r--
Rewrote the Bonjour classes, using the low-level <dns_sd.h> API. They're now subclasses of MYDNSService.
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@28
    22
/** Initializes the lookup with a DNS hostname. */
jens@28
    23
- (id) initWithHostname: (NSString*)hostname;
jens@28
    24
jens@28
    25
/** The port number; this will be copied into the resulting IPAddress objects.
jens@28
    26
    Defaults to zero, but you can set it before calling -start. */
jens@28
    27
@property UInt16 port;
jens@28
    28
jens@28
    29
/** The index of the network interface. You usually don't need to set this. */
jens@28
    30
@property UInt16 interfaceIndex;
jens@28
    31
jens@28
    32
/** The resulting address(es) of the host, as HostAddress objects. */
jens@28
    33
@property (readonly) NSSet *addresses;
jens@28
    34
jens@28
    35
/** How much longer the addresses will remain valid.
jens@28
    36
    If the value is zero, the addresses are no longer valid, and you should instead
jens@28
    37
    call -start again and wait for the 'addresses' property to update.
jens@28
    38
    If you set the service to continuous mode, addresses will never expire since the
jens@28
    39
    query will continue to update them. */
jens@28
    40
@property (readonly) NSTimeInterval timeToLive;
jens@28
    41
jens@28
    42
@end