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