TCP/TCPEndpoint.h
author Jens Alfke <jens@mooseyard.com>
Tue Jun 03 22:24:21 2008 -0700 (2008-06-03)
changeset 12 710113961756
parent 0 9d67172bb323
child 26 cb9cdf247239
permissions -rw-r--r--
BLIP.py working for listener side (it talks to the Obj-C BLIPConnectionTester.)
     1 //
     2 //  TCPEndpoint.h
     3 //  MYNetwork
     4 //
     5 //  Created by Jens Alfke on 5/14/08.
     6 //  Copyright 2008 Jens Alfke. All rights reserved.
     7 //
     8 
     9 #import <Foundation/Foundation.h>
    10 #if TARGET_OS_IPHONE
    11 #include <CFNetwork/CFSocketStream.h>
    12 #else
    13 #import <CoreServices/CoreServices.h>
    14 #endif
    15 
    16 
    17 // SSL properties:
    18 #define kTCPPropertySSLCertificates  ((NSString*)kCFStreamSSLCertificates)
    19 #define kTCPPropertySSLAllowsAnyRoot ((NSString*)kCFStreamSSLAllowsAnyRoot)
    20 
    21 extern NSString* const kTCPPropertySSLClientSideAuthentication;    // value is TCPAuthenticate enum
    22 typedef enum {
    23 	kTCPNeverAuthenticate,			/* skip client authentication */
    24 	kTCPAlwaysAuthenticate,         /* require it */
    25 	kTCPTryAuthenticate             /* try to authenticate, but not error if client has no cert */
    26 } TCPAuthenticate; // these MUST have same values as SSLAuthenticate enum in SecureTransport.h!
    27 
    28 
    29 /** Abstract base class of TCPConnection and TCPListener.
    30     Mostly just manages the SSL properties. */
    31 @interface TCPEndpoint : NSObject
    32 {
    33     NSMutableDictionary *_sslProperties;
    34     id _delegate;
    35 }
    36 
    37 /** The desired security level. Use the security level constants from NSStream.h,
    38     such as NSStreamSocketSecurityLevelNegotiatedSSL. */
    39 @property (copy) NSString *securityLevel;
    40 
    41 /** Detailed SSL settings. This is the same as CFStream's kCFStreamPropertySSLSettings
    42     property. */
    43 @property (copy) NSMutableDictionary *SSLProperties;
    44 
    45 /** Shortcut to set a single SSL property. */
    46 - (void) setSSLProperty: (id)value 
    47                  forKey: (NSString*)key;
    48 
    49 //protected:
    50 - (void) tellDelegate: (SEL)selector withObject: (id)param;
    51 
    52 @end