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