|
Samond Classes Library 1.1.6-RELEASE build 132
|
00001 // 00002 // SCNetException.h 00003 // scl 00004 // 00005 // Created by Viacheslav Smolensky on 02.11.11. 00006 // Copyright (c) 2007 - 2014 by Samond Development Corporation. All rights reserved. 00007 // 00008 00015 #import <Foundation/Foundation.h> 00016 #import <scl/SCTypes.h> 00017 #import <scl/SCException.h> 00018 00019 #define SCNetExceptionClass @"SCNetException" ///< SCNetException class name 00020 00021 #pragma mark Exception supporting types 00022 00028 enum _SCNetError { 00029 SCNetErrorUnspecified = 0, 00030 SCNetErrorSubnetMask = 1, 00031 SCNetErrorWildcardMask = 2, 00032 SCNetErrorSubnetPrefix = 3, 00033 SCNetErrorIPAddress = 4 00034 }; 00035 00041 typedef enum _SCNetError SCNetError; 00042 00043 #pragma mark - 00044 #pragma mark Exception name constant 00045 00047 #define SCNetErrorName @"SCNet" ///< Name of exception 00048 00049 #pragma mark - 00050 00061 @interface SCNetException : SCException { 00062 SCNetError fType; // Network exception type 00063 NSString *fData; // Network exception data 00064 SCSystemError fError; // System error code 00065 } 00066 #pragma mark - 00067 #pragma mark Class properties 00068 #if (__MAC_OS_X_VERSION_MIN_REQUIRED > 1040) || IOS_TARGET 00069 // Network exception type property 00070 @property (nonatomic, assign, readonly, getter=type) SCNetError type; 00071 // Network exception data property 00072 @property (nonatomic, retain, readonly, getter=data) NSString *data; 00073 // System error code property 00074 @property (nonatomic, assign, readonly, getter=error) SCSystemError error; 00075 #endif 00076 00077 #pragma mark - 00078 #pragma mark Creating and Initializing Generic Network Exception 00079 00084 + (SCNetException *)exception; 00085 00091 + (SCNetException *)exceptionWithReason:(NSString *)reason; 00092 00099 + (SCNetException *)exceptionWithType:(SCNetError)type reason:(NSString *)reason; 00100 00108 + (SCNetException *)exceptionWithType:(SCNetError)type 00109 data:(NSString *)data 00110 error:(SCSystemError)error; 00111 00118 + (SCNetException *)exceptionWithType:(SCNetError)type data:(NSString *)data; 00119 00125 + (SCNetException *)exceptionWithType:(SCNetError)type; 00126 00131 - (id)init; 00132 00138 - (id)initWithReason:(NSString *)reason; 00139 00146 - (id)initWithType:(SCNetError)type reason:(NSString *)reason; 00147 00155 - (id)initWithType:(SCNetError)type data:(NSString *)data error:(SCSystemError)error; 00156 00163 - (id)initWithType:(SCNetError)type data:(NSString *)data; 00164 00170 - (id)initWithType:(SCNetError)type; 00171 00172 #pragma mark - 00173 #pragma mark Creating and Initializing Subnets Related Exception 00174 00179 + (SCNetException *)exceptionWithEmptySubnetMask; 00180 00186 + (SCNetException *)exceptionWithSubnetMask:(NSString *)mask; 00187 00193 + (SCNetException *)exceptionWithUncontinuouslySubnetMask:(NSString *)mask; 00194 00199 + (SCNetException *)exceptionWithEmptyWildcardMask; 00200 00206 + (SCNetException *)exceptionWithWildcardMask:(NSString *)wildcard; 00207 00213 + (SCNetException *)exceptionWithUncontinuouslyWildcardMask:(NSString *)wildcard; 00214 00220 + (SCNetException *)exceptionWithSubnetHostsCount:(SCUInteger)count; 00221 00226 + (SCNetException *)exceptionWithEmptySourceSubnetMask; 00227 00232 + (SCNetException *)exceptionWithHostSubnet; 00233 00238 + (SCNetException *)exceptionWithHostWildcard; 00239 00244 + (SCNetException *)exceptionWithEmptySubnet; 00245 00250 + (SCNetException *)exceptionWithStartAddressLess; 00251 00256 + (SCNetException *)exceptionWithEmptySubnetsArray; 00257 00262 - (id)initWithEmptySubnetMask; 00263 00269 - (id)initWithSubnetMask:(NSString *)mask; 00270 00276 - (id)initWithUncontinuouslySubnetMask:(NSString *)mask; 00277 00282 - (id)initWithEmptyWildcardMask; 00283 00289 - (id)initWithWildcardMask:(NSString *)wildcard; 00290 00296 - (id)initWithUncontinuouslyWildcardMask:(NSString *)wildcard; 00297 00303 - (id)initWithSubnetHostsCount:(SCUInteger)count; 00304 00309 - (id)initWithEmptySourceSubnetMask; 00310 00315 - (id)initWithHostSubnet; 00316 00321 - (id)initWithHostWildcard; 00322 00327 - (id)initWithEmptySubnet; 00328 00333 - (id)initWithStartAddressLess; 00334 00339 - (id)initWithEmptySubnetsArray; 00340 00341 #pragma mark - 00342 #pragma mark Creating and Initializing Subnet Prefixes Related Exception 00343 00349 + (SCNetException *)exceptionWithSubnetPrefix:(NSString *)prefix; 00350 00356 + (SCNetException *)exceptionWithPrefixLength:(SCUByte)length; 00357 00362 + (SCNetException *)exceptionWithEmptySubnetPrefix; 00363 00368 + (SCNetException *)exceptionWithHostPrefixLength; 00369 00374 + (SCNetException *)exceptionWithHostSubnetPrefix; 00375 00381 - (id)initWithSubnetPrefix:(NSString *)prefix; 00382 00388 - (id)initWithPrefixLength:(SCUByte)length; 00389 00394 - (id)initWithEmptySubnetPrefix; 00395 00400 - (id)initWithHostPrefixLength; 00401 00406 - (id)initWithHostSubnetPrefix; 00407 00408 #pragma mark - 00409 #pragma mark Creating and Initializing IP Addresses Related Exception 00410 00416 + (SCNetException *)exceptionWithAddress:(NSString *)address; 00417 00422 + (SCNetException *)exceptionWithEmptyAddress; 00423 00429 + (SCNetException *)exceptionWithFirstOctet:(NSString *)octet; 00430 00436 + (SCNetException *)exceptionWithRawAddress:(SCUInteger)raw; 00437 00442 + (SCNetException *)exceptionWithEmptySourceAddress; 00443 00449 + (SCNetException *)exceptionWithSubnetAddress:(NSString *)address; 00450 00455 + (SCNetException *)exceptionWithEmptyStartAddress; 00456 00461 + (SCNetException *)exceptionWithEmptyEndAddress; 00462 00468 - (id)initWithAddress:(NSString *)address; 00469 00474 - (id)initWithEmptyAddress; 00475 00481 - (id)initWithFirstOctet:(NSString *)octet; 00482 00488 - (id)initWithRawAddress:(SCUInteger)raw; 00489 00494 - (id)initWithEmptySourceAddress; 00495 00501 - (id)initWithSubnetAddress:(NSString *)address; 00502 00507 - (id)initWithEmptyStartAddress; 00508 00513 - (id)initWithEmptyEndAddress; 00514 00515 #pragma mark - 00516 #pragma mark Querying Exception Properties 00517 00522 - (SCNetError)type; 00523 00528 - (NSString *)data; 00529 00534 - (SCSystemError)error; 00535 00540 - (void)setType:(SCNetError)type; 00541 00546 - (void)setData:(NSString *)data; 00547 00552 - (void)setError:(SCSystemError)error; 00553 00554 @end
1.7.3