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.
     1 //
     2 //  MYAddressLookup.h
     3 //  MYNetwork
     4 //
     5 //  Created by Jens Alfke on 4/24/09.
     6 //  Copyright 2009 Jens Alfke. All rights reserved.
     7 //
     8 
     9 #import "MYDNSService.h"
    10 
    11 
    12 /** An asynchronous DNS address lookup. Supports both Bonjour services and traditional hostnames. */
    13 @interface MYAddressLookup : MYDNSService
    14 {
    15     NSString *_hostname;
    16     UInt16 _interfaceIndex;
    17     NSMutableSet *_addresses;
    18     UInt16 _port;
    19     CFAbsoluteTime _expires;
    20 }
    21 
    22 /** Initializes the lookup with a DNS hostname. */
    23 - (id) initWithHostname: (NSString*)hostname;
    24 
    25 /** The port number; this will be copied into the resulting IPAddress objects.
    26     Defaults to zero, but you can set it before calling -start. */
    27 @property UInt16 port;
    28 
    29 /** The index of the network interface. You usually don't need to set this. */
    30 @property UInt16 interfaceIndex;
    31 
    32 /** The resulting address(es) of the host, as HostAddress objects. */
    33 @property (readonly) NSSet *addresses;
    34 
    35 /** How much longer the addresses will remain valid.
    36     If the value is zero, the addresses are no longer valid, and you should instead
    37     call -start again and wait for the 'addresses' property to update.
    38     If you set the service to continuous mode, addresses will never expire since the
    39     query will continue to update them. */
    40 @property (readonly) NSTimeInterval timeToLive;
    41 
    42 @end