PortMapper/MYPortMapper.h
changeset 61 981f9d604c88
parent 26 cb9cdf247239
     1.1 --- a/PortMapper/MYPortMapper.h	Wed Apr 22 16:45:39 2009 -0700
     1.2 +++ b/PortMapper/MYPortMapper.h	Tue Jul 21 10:04:10 2009 -0700
     1.3 @@ -6,8 +6,7 @@
     1.4  //  Copyright 2008 Jens Alfke. All rights reserved.
     1.5  //
     1.6  
     1.7 -#import <Foundation/Foundation.h>
     1.8 -#import <CoreFoundation/CFSocket.h>
     1.9 +#import "MYDNSService.h"
    1.10  @class IPAddress;
    1.11  
    1.12  
    1.13 @@ -34,14 +33,11 @@
    1.14      * When the MYPortMapper reports changes, you (somehow) notify peers of the changes.
    1.15      * When closing the network service, close the MYPortMapper object too.
    1.16  */ 
    1.17 -@interface MYPortMapper : NSObject
    1.18 +@interface MYPortMapper : MYDNSService
    1.19  {
    1.20 +    @private
    1.21      UInt16 _localPort, _desiredPublicPort;
    1.22      BOOL _mapTCP, _mapUDP;
    1.23 -    SInt32 _error;
    1.24 -    void* /*DNSServiceRef*/ _service; // Typed void* to avoid having to #include <dnssd.h>
    1.25 -    CFSocketRef _socket;
    1.26 -    CFRunLoopSourceRef _socketSource;
    1.27      IPAddress *_publicAddress, *_localAddress;
    1.28  }
    1.29  
    1.30 @@ -65,14 +61,6 @@
    1.31      This property has no effect if changed while the PortMapper is open. */
    1.32  @property UInt16 desiredPublicPort;
    1.33  
    1.34 -/** Opens the PortMapper, using the current settings of the above properties.
    1.35 -    Returns immediately; you can find out when the mapping is created or fails
    1.36 -    by observing the error/publicAddress/publicPort properties, or by listening
    1.37 -    for the PortMapperChangedNotification.
    1.38 -    It's very unlikely that this call will fail (return NO). If it does, it
    1.39 -    probably means that the mDNSResponder process isn't working. */
    1.40 -- (BOOL) open;
    1.41 -
    1.42  /** Blocks till the PortMapper finishes opening. Returns YES if it opened, NO on error.
    1.43      It's not usually a good idea to use this, as it will lock up your application
    1.44      until a response arrives from the NAT. Listen for asynchronous notifications instead.
    1.45 @@ -80,14 +68,6 @@
    1.46      If called when it's already open, it just returns YES. */
    1.47  - (BOOL) waitTillOpened;
    1.48  
    1.49 -/** Closes the PortMapper, terminating any open port mapping. */
    1.50 -- (void) close;
    1.51 -
    1.52 -/** The error status, a DNSServiceErrorType enum; nonzero if something went wrong. 
    1.53 -    The most likely error is kDNSServiceErr_NATPortMappingUnsupported (-65564).
    1.54 -    This property is KV observable. */
    1.55 -@property (readonly) SInt32 error;
    1.56 -
    1.57  /** The known public IPv4 address/port, once it's been determined.
    1.58      This property is KV observable. */
    1.59  @property (readonly,retain) IPAddress* publicAddress;