TCP/TCPEndpoint.m
author Jens Alfke <jens@mooseyard.com>
Sun May 25 12:32:47 2008 -0700 (2008-05-25)
changeset 5 2c4bb6968927
child 26 cb9cdf247239
permissions -rw-r--r--
More documentation.
     1 //
     2 //  BLIPEndpoint.m
     3 //  MYNetwork
     4 //
     5 //  Created by Jens Alfke on 5/14/08.
     6 //  Copyright 2008 Jens Alfke. All rights reserved.
     7 //
     8 
     9 #import "TCPEndpoint.h"
    10 
    11 #import "ExceptionUtils.h"
    12 
    13 
    14 NSString* const kTCPPropertySSLClientSideAuthentication = @"kTCPPropertySSLClientSideAuthentication";
    15 
    16 
    17 @implementation TCPEndpoint
    18 
    19 
    20 - (void) dealloc
    21 {
    22     [_sslProperties release];
    23     [super dealloc];
    24 }
    25 
    26 
    27 - (NSMutableDictionary*) SSLProperties {return _sslProperties;}
    28 
    29 - (void) setSSLProperties: (NSMutableDictionary*)props
    30 {
    31     if( props != _sslProperties ) {
    32         [_sslProperties release];
    33         _sslProperties = [props mutableCopy];
    34     }
    35 }
    36 
    37 - (void) setSSLProperty: (id)value forKey: (NSString*)key
    38 {
    39     if( value ) {
    40         if( ! _sslProperties )
    41             _sslProperties = [[NSMutableDictionary alloc] init];
    42         [_sslProperties setObject: value forKey: key];
    43     } else
    44         [_sslProperties removeObjectForKey: key];
    45 }
    46 
    47 - (NSString*) securityLevel                 {return [_sslProperties objectForKey: (id)kCFStreamSSLLevel];}
    48 - (void) setSecurityLevel: (NSString*)level {[self setSSLProperty: level forKey: (id)kCFStreamSSLLevel];}
    49 
    50 
    51 - (void) tellDelegate: (SEL)selector withObject: (id)param
    52 {
    53     if( [_delegate respondsToSelector: selector] ) {
    54         @try{
    55             [_delegate performSelector: selector withObject: self withObject: param];
    56         }catchAndReport(@"%@ delegate",self.class);
    57     }
    58 }
    59 
    60 
    61 @end
    62 
    63 
    64 /*
    65  Copyright (c) 2008, Jens Alfke <jens@mooseyard.com>. All rights reserved.
    66  
    67  Redistribution and use in source and binary forms, with or without modification, are permitted
    68  provided that the following conditions are met:
    69  
    70  * Redistributions of source code must retain the above copyright notice, this list of conditions
    71  and the following disclaimer.
    72  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
    73  and the following disclaimer in the documentation and/or other materials provided with the
    74  distribution.
    75  
    76  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
    77  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 
    78  FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRI-
    79  BUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    80  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
    81   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
    82  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 
    83  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    84  */