jens@0: // jens@0: // TCPEndpoint.h jens@0: // MYNetwork jens@0: // jens@0: // Created by Jens Alfke on 5/14/08. jens@0: // Copyright 2008 Jens Alfke. All rights reserved. jens@0: // jens@0: jens@0: #import jens@8: #if TARGET_OS_IPHONE jens@8: #include jens@8: #else jens@0: #import jens@8: #endif jens@0: jens@0: jens@0: // SSL properties: jens@0: #define kTCPPropertySSLCertificates ((NSString*)kCFStreamSSLCertificates) jens@0: #define kTCPPropertySSLAllowsAnyRoot ((NSString*)kCFStreamSSLAllowsAnyRoot) jens@8: jens@8: extern NSString* const kTCPPropertySSLClientSideAuthentication; // value is TCPAuthenticate enum jens@8: typedef enum { jens@8: kTCPNeverAuthenticate, /* skip client authentication */ jens@8: kTCPAlwaysAuthenticate, /* require it */ jens@8: kTCPTryAuthenticate /* try to authenticate, but not error if client has no cert */ jens@8: } TCPAuthenticate; // these MUST have same values as SSLAuthenticate enum in SecureTransport.h! jens@0: jens@0: jens@0: /** Abstract base class of TCPConnection and TCPListener. jens@0: Mostly just manages the SSL properties. */ jens@0: @interface TCPEndpoint : NSObject jens@0: { jens@0: NSMutableDictionary *_sslProperties; jens@0: id _delegate; jens@0: } jens@0: jens@0: /** The desired security level. Use the security level constants from NSStream.h, jens@0: such as NSStreamSocketSecurityLevelNegotiatedSSL. */ jens@0: @property (copy) NSString *securityLevel; jens@0: jens@0: /** Detailed SSL settings. This is the same as CFStream's kCFStreamPropertySSLSettings jens@0: property. */ jens@0: @property (copy) NSMutableDictionary *SSLProperties; jens@0: jens@0: /** Shortcut to set a single SSL property. */ jens@0: - (void) setSSLProperty: (id)value jens@0: forKey: (NSString*)key; jens@0: jens@0: //protected: jens@0: - (void) tellDelegate: (SEL)selector withObject: (id)param; jens@0: jens@0: @end