Bonjour/MYAddressLookup.h
author Dan Preston <danpreston@codechemistry.com>
Tue May 05 15:10:15 2009 -0700 (2009-05-05)
changeset 37 7c7d5a0cb4d6
parent 28 732576fa8a0d
child 50 63baa74c903f
permissions -rw-r--r--
Fixed the leak of SecIdentityRef objects in a while loop.
     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     (If you've got a Bonjour service already, as a MYBonjourService object, it's more convenient
    24     to access its addressLookup property instead of creating your own instance.) */
    25 - (id) initWithHostname: (NSString*)hostname;
    26 
    27 /** The port number; this will be copied into the resulting IPAddress objects.
    28     Defaults to zero, but you can set it before calling -start. */
    29 @property UInt16 port;
    30 
    31 /** The index of the network interface to use, or zero (the default) for any interface.
    32     You usually don't need to set this. */
    33 @property UInt16 interfaceIndex;
    34 
    35 /** The resulting address(es) of the host, as HostAddress objects. */
    36 @property (readonly) NSSet *addresses;
    37 
    38 /** How much longer the addresses will remain valid.
    39     If the value is zero, the addresses are no longer valid, and you should instead
    40     call -start again and wait for the 'addresses' property to update.
    41     If you set the service to continuous mode, addresses will never expire since the
    42     query will continue to update them. */
    43 @property (readonly) NSTimeInterval timeToLive;
    44 
    45 @end