|
Samond Classes Library 1.1.6-RELEASE build 132
|
00001 // 00002 // SCSubnet.h 00003 // scl 00004 // 00005 // Created by Viacheslav Smolensky on 17.08.09. 00006 // Copyright (c) 2007 - 2014 by Samond Development Corporation. All rights reserved. 00007 // 00008 00015 #import <Foundation/Foundation.h> 00016 #import <scl/SCNetObject.h> 00017 #import <scl/SCIPAddress.h> 00018 #import <scl/SCSubnetMask.h> 00019 00020 #define SCSubnetClass @"SCSubnet" ///< SCSubnet class name 00021 00022 #pragma mark - 00023 00045 @interface SCSubnet : SCNetObject { 00046 SCIPAddress *fAddress; // Subnet address 00047 SCSubnetMask *fMask; // Subnet mask 00048 } 00049 00050 #pragma mark - 00051 #pragma mark Class properties 00052 #if (__MAC_OS_X_VERSION_MIN_REQUIRED > 1040) || IOS_TARGET 00053 // Subnet address read only property 00054 @property (nonatomic, retain, readonly, getter=address) SCIPAddress *address; 00055 // Subnet address read only property 00056 @property (nonatomic, retain, readonly, getter=netAddress) SCIPAddress *netAddress; 00057 // Subnet broadcast read only property 00058 @property (nonatomic, retain, readonly, getter=broadcastAddress) SCIPAddress *broadcastAddress; 00059 // Subnet first regular address read only property 00060 @property (nonatomic, retain, readonly, getter=firstAddress) SCIPAddress *firstAddress; 00061 // Subnet last regular address read only property 00062 @property (nonatomic, retain, readonly, getter=lastAddress) SCIPAddress *lastAddress; 00063 // Subnet mask read only property 00064 @property (nonatomic, retain, readonly, getter=mask) SCSubnetMask *mask; 00065 // Subnet prefix read only property 00066 @property (nonatomic, retain, readonly, getter=prefix) NSString *prefix; 00067 // Subnet length read only property 00068 @property (nonatomic, readonly, getter=length) SCUByte length; 00069 // Subnet wildcard mask read only property 00070 @property (nonatomic, retain, readonly, getter=wildcard) NSString *wildcard; 00071 // Subnet string with mask read only property 00072 @property (nonatomic, retain, readonly, getter=stringWithMask) NSString *stringWithMask; 00073 // Subnet string with prefix read only property 00074 @property (nonatomic, retain, readonly, getter=stringWithPrefix) NSString *stringWithPrefix; 00075 // Subnet hosts count read only property 00076 @property (nonatomic, readonly, getter=count) SCUInteger count; 00077 // Subnet class read only property 00078 @property (nonatomic, readonly, getter=subnetClass) NSString *subnetClass; 00079 #endif 00080 00081 #pragma mark - 00082 #pragma mark Creating Subnets 00083 00088 + (SCSubnet *)subnet; 00089 00096 + (SCSubnet *)subnetWithAddress:(SCIPAddress *)address; 00097 00105 + (SCSubnet *)subnetWithAddress:(SCIPAddress *)address mask:(SCSubnetMask *)mask; 00106 00114 + (SCSubnet *)subnetWithAddress:(SCIPAddress *)address maskString:(NSString *)mask; 00115 00123 + (SCSubnet *)subnetWithAddress:(SCIPAddress *)address length:(SCUByte)length; 00124 00132 + (SCSubnet *)subnetWithAddress:(SCIPAddress *)address prefix:(NSString *)prefix; 00133 00141 + (SCSubnet *)subnetWithAddress:(SCIPAddress *)address wildcard:(NSString *)wildcard; 00142 00150 + (SCSubnet *)subnetWithAddress:(SCIPAddress *)address count:(SCUInteger)count; 00151 00158 + (SCSubnet *)subnetWithString:(NSString *)address; 00159 00167 + (SCSubnet *)subnetWithString:(NSString *)address mask:(SCSubnetMask *)mask; 00168 00176 + (SCSubnet *)subnetWithString:(NSString *)address maskString:(NSString *)mask; 00177 00185 + (SCSubnet *)subnetWithString:(NSString *)address length:(SCUByte)length; 00186 00194 + (SCSubnet *)subnetWithString:(NSString *)address prefix:(NSString *)prefix; 00195 00203 + (SCSubnet *)subnetWithString:(NSString *)address wildcard:(NSString *)wildcard; 00204 00212 + (SCSubnet *)subnetWithString:(NSString *)address count:(SCUInteger)count; 00213 00219 + (SCSubnet *)subnetWithSubnet:(SCSubnet *)subnet; 00220 00225 + (SCSubnet *)subnetWithInternet; 00226 00235 + (SCSubnet *)subnetWithStartAddress:(SCIPAddress *)start endAddress:(SCIPAddress *)end; 00236 00245 + (SCSubnet *)subnetWithStartString:(NSString *)start endString:(NSString *)end; 00246 00253 + (SCSubnet *)subnetWithSubnets:(NSArray *)subnets; 00254 00260 + (SCSubnet *)subnetWithDataDictionary:(NSDictionary *)dictionary; 00261 00267 + (SCSubnet *)subnetWithDataDictionaryFromFile:(NSString *)path; 00268 00274 + (SCSubnet *)subnetWithCoder:(NSCoder *)coder; 00275 00281 + (SCSubnet *)subnetWithContentsOfSerializedFile:(NSString *)path; 00282 00290 + (SCSubnet *)subnetWithStream:(SCStream *)stream; 00291 00298 + (SCSubnet *)subnetWithFileStream:(NSString *)path; 00299 00300 #pragma mark - 00301 #pragma mark Initializing Subnets 00302 00307 - (id)init; 00308 00315 - (id)initWithAddress:(SCIPAddress *)address; 00316 00324 - (id)initWithAddress:(SCIPAddress *)address mask:(SCSubnetMask *)mask; 00325 00333 - (id)initWithAddress:(SCIPAddress *)address maskString:(NSString *)mask; 00334 00342 - (id)initWithAddress:(SCIPAddress *)address length:(SCUByte)length; 00343 00351 - (id)initWithAddress:(SCIPAddress *)address prefix:(NSString *)prefix; 00352 00360 - (id)initWithAddress:(SCIPAddress *)address wildcard:(NSString *)wildcard; 00361 00369 - (id)initWithAddress:(SCIPAddress *)address count:(SCUInteger)count; 00370 00377 - (id)initWithString:(NSString *)address; 00378 00386 - (id)initWithString:(NSString *)address mask:(SCSubnetMask *)mask; 00387 00395 - (id)initWithString:(NSString *)address maskString:(NSString *)mask; 00396 00404 - (id)initWithString:(NSString *)address length:(SCUByte)length; 00405 00413 - (id)initWithString:(NSString *)address prefix:(NSString *)prefix; 00414 00422 - (id)initWithString:(NSString *)address wildcard:(NSString *)wildcard; 00423 00431 - (id)initWithString:(NSString *)address count:(SCUInteger)count; 00432 00439 - (id)initWithSubnet:(SCSubnet *)subnet; 00440 00445 - (id)initWithInternet; 00446 00455 - (id)initWithStartAddress:(SCIPAddress *)start endAddress:(SCIPAddress *)end; 00456 00465 - (id)initWithStartString:(NSString *)start endString:(NSString *)end; 00466 00473 - (id)initWithSubnets:(NSArray *)subnets; 00474 00475 #pragma mark - 00476 #pragma mark Comparing Subnets 00477 00485 - (BOOL)isEqual:(id)subnet; 00486 00492 - (BOOL)isEqualToSubnet:(SCSubnet *)subnet; 00493 00500 - (BOOL)isEqualToAddress:(SCIPAddress *)address; 00501 00510 - (BOOL)isEqualToAddress:(SCIPAddress *)address mask:(SCSubnetMask *)mask; 00511 00520 - (BOOL)isEqualToAddress:(SCIPAddress *)address maskString:(NSString *)mask; 00521 00530 - (BOOL)isEqualToAddress:(SCIPAddress *)address length:(SCUByte)length; 00531 00540 - (BOOL)isEqualToAddress:(SCIPAddress *)address prefix:(NSString *)prefix; 00541 00550 - (BOOL)isEqualToAddress:(SCIPAddress *)address wildcard:(NSString *)wildcard; 00551 00560 - (BOOL)isEqualToAddress:(SCIPAddress *)address count:(SCUInteger)count; 00561 00568 - (BOOL)isEqualToString:(NSString *)address; 00569 00578 - (BOOL)isEqualToString:(NSString *)address mask:(SCSubnetMask *)mask; 00579 00588 - (BOOL)isEqualToString:(NSString *)address maskString:(NSString *)mask; 00589 00598 - (BOOL)isEqualToString:(NSString *)address length:(SCUByte)length; 00599 00608 - (BOOL)isEqualToString:(NSString *)address prefix:(NSString *)prefix; 00609 00618 - (BOOL)isEqualToString:(NSString *)address wildcard:(NSString *)wildcard; 00619 00628 - (BOOL)isEqualToString:(NSString *)address count:(SCUInteger)count; 00629 00636 - (BOOL)isEqualToMask:(SCSubnetMask *)mask; 00637 00645 - (BOOL)isEqualToMaskString:(NSString *)mask; 00646 00654 - (BOOL)isEqualToLength:(SCUByte)length; 00655 00663 - (BOOL)isEqualToPrefix:(NSString *)prefix; 00664 00672 - (BOOL)isEqualToWildcard:(NSString *)wildcard; 00673 00681 - (BOOL)isEqualToCount:(SCUInteger)count; 00682 00689 - (BOOL)isEqualToNetAddress:(SCIPAddress *)address; 00690 00698 - (BOOL)isEqualToNetString:(NSString *)address; 00699 00709 - (BOOL)isEqualToStartAddress:(SCIPAddress *)start endAddress:(SCIPAddress *)end; 00710 00720 - (BOOL)isEqualToStartString:(NSString *)start endString:(NSString *)end; 00721 00728 - (BOOL)isEqualToSubnets:(NSArray *)subnets; 00729 00730 #pragma mark - 00731 #pragma mark Setting Subnets 00732 00738 - (void)setAddress:(SCIPAddress *)address; 00739 00746 - (void)setAddress:(SCIPAddress *)address mask:(SCSubnetMask *)mask; 00747 00754 - (void)setAddress:(SCIPAddress *)address maskString:(NSString *)mask; 00755 00762 - (void)setAddress:(SCIPAddress *)address length:(SCUByte)length; 00763 00770 - (void)setAddress:(SCIPAddress *)address prefix:(NSString *)prefix; 00771 00778 - (void)setAddress:(SCIPAddress *)address wildcard:(NSString *)wildcard; 00779 00786 - (void)setAddress:(SCIPAddress *)address count:(SCUInteger)count; 00787 00793 - (void)setString:(NSString *)address; 00794 00801 - (void)setString:(NSString *)address mask:(SCSubnetMask *)mask; 00802 00809 - (void)setString:(NSString *)address maskString:(NSString *)mask; 00810 00817 - (void)setString:(NSString *)address length:(SCUByte)length; 00818 00825 - (void)setString:(NSString *)address prefix:(NSString *)prefix; 00826 00833 - (void)setString:(NSString *)address wildcard:(NSString *)wildcard; 00834 00841 - (void)setString:(NSString *)address count:(SCUInteger)count; 00842 00848 - (void)copySubnet:(SCSubnet *)subnet; 00849 00857 - (void)setStartAddress:(SCIPAddress *)start endAddress:(SCIPAddress *)end; 00858 00866 - (void)setStartString:(NSString *)start endString:(NSString *)end; 00867 00873 - (void)setSubnets:(NSArray *)subnets; 00874 00875 #pragma mark - 00876 #pragma mark Querying Subnet Related Addresses 00877 00882 - (SCIPAddress *)netAddress; 00883 00888 - (SCIPAddress *)broadcastAddress; 00889 00894 - (SCIPAddress *)firstAddress; 00895 00900 - (SCIPAddress *)lastAddress; 00901 00902 #pragma mark - 00903 #pragma mark Querying Subnet 00904 00909 - (SCIPAddress *)address; 00910 00915 - (SCSubnetMask *)mask; 00916 00921 - (NSString *)prefix; 00922 00927 - (SCUByte)length; 00928 00933 - (NSString *)wildcard; 00934 00939 - (NSString *)stringWithMask; 00940 00945 - (NSString *)stringWithPrefix; 00946 00951 - (NSString *)description; 00952 00953 #pragma mark - 00954 #pragma mark Querying Subnet Hosts Count 00955 00960 - (SCUInteger)count; 00961 00962 #pragma mark - 00963 #pragma mark Subnet Address Methods 00964 00970 - (BOOL)isIncludeAddress:(SCIPAddress *)address; 00971 00978 - (BOOL)isIncludeString:(NSString *)address; 00979 00985 - (BOOL)isHostAddress:(SCIPAddress *)address; 00986 00993 - (BOOL)isHostString:(NSString *)address; 00994 01000 - (BOOL)isNetAddress:(SCIPAddress *)address; 01001 01008 - (BOOL)isNetString:(NSString *)address; 01009 01015 - (BOOL)isBroadcast:(SCIPAddress *)address; 01016 01023 - (BOOL)isBroadcastString:(NSString *)address; 01024 01025 #pragma mark - 01026 #pragma mark Subnetting 01027 01033 - (BOOL)isIncludeSubnet:(SCSubnet *)subnet; 01034 01042 - (BOOL)isIncludeSubnetWithAddress:(SCIPAddress *)address; 01043 01051 - (BOOL)isIncludeSubnetWithAddress:(SCIPAddress *)address mask:(SCSubnetMask *)mask; 01052 01061 - (BOOL)isIncludeSubnetWithAddress:(SCIPAddress *)address maskString:(NSString *)mask; 01062 01071 - (BOOL)isIncludeSubnetWithAddress:(SCIPAddress *)address length:(SCUByte)length; 01072 01081 - (BOOL)isIncludeSubnetWithAddress:(SCIPAddress *)address prefix:(NSString *)prefix; 01082 01091 - (BOOL)isIncludeSubnetWithAddress:(SCIPAddress *)address wildcard:(NSString *)wildcard; 01092 01101 - (BOOL)isIncludeSubnetWithAddress:(SCIPAddress *)address count:(SCUInteger)count; 01102 01110 - (BOOL)isIncludeSubnetWithString:(NSString *)address; 01111 01120 - (BOOL)isIncludeSubnetWithString:(NSString *)address mask:(SCSubnetMask *)mask; 01121 01130 - (BOOL)isIncludeSubnetWithString:(NSString *)address maskString:(NSString *)mask; 01131 01140 - (BOOL)isIncludeSubnetWithString:(NSString *)address length:(SCUByte)length; 01141 01150 - (BOOL)isIncludeSubnetWithString:(NSString *)address prefix:(NSString *)prefix; 01151 01160 - (BOOL)isIncludeSubnetWithString:(NSString *)address wildcard:(NSString *)wildcard; 01161 01170 - (BOOL)isIncludeSubnetWithString:(NSString *)address count:(SCUInteger)count; 01171 01181 - (BOOL)isIncludeSubnetWithStartAddress:(SCIPAddress *)start endAddress:(SCIPAddress *)end; 01182 01192 - (BOOL)isIncludeSubnetWithStartString:(NSString *)start endString:(NSString *)end; 01193 01201 - (BOOL)isIncludeSubnets:(NSArray *)subnets; 01202 01208 - (BOOL)isIncludedIntoSubnet:(SCSubnet *)subnet; 01209 01217 - (BOOL)isIncludedIntoSubnetWithAddress:(SCIPAddress *)address; 01218 01227 - (BOOL)isIncludedIntoSubnetWithAddress:(SCIPAddress *)address mask:(SCSubnetMask *)mask; 01228 01237 - (BOOL)isIncludedIntoSubnetWithAddress:(SCIPAddress *)address maskString:(NSString *)mask; 01238 01247 - (BOOL)isIncludedIntoSubnetWithAddress:(SCIPAddress *)address length:(SCUByte)length; 01248 01257 - (BOOL)isIncludedIntoSubnetWithAddress:(SCIPAddress *)address prefix:(NSString *)prefix; 01258 01267 - (BOOL)isIncludedIntoSubnetWithAddress:(SCIPAddress *)address wildcard:(NSString *)wildcard; 01268 01277 - (BOOL)isIncludedIntoSubnetWithAddress:(SCIPAddress *)address count:(SCUInteger)count; 01278 01286 - (BOOL)isIncludedIntoSubnetWithString:(NSString *)address; 01287 01296 - (BOOL)isIncludedIntoSubnetWithString:(NSString *)address mask:(SCSubnetMask *)mask; 01297 01306 - (BOOL)isIncludedIntoSubnetWithString:(NSString *)address maskString:(NSString *)mask; 01307 01316 - (BOOL)isIncludedIntoSubnetWithString:(NSString *)address length:(SCUByte)length; 01317 01326 - (BOOL)isIncludedIntoSubnetWithString:(NSString *)address prefix:(NSString *)prefix; 01327 01336 - (BOOL)isIncludedIntoSubnetWithString:(NSString *)address wildcard:(NSString *)wildcard; 01337 01346 - (BOOL)isIncludedIntoSubnetWithString:(NSString *)address count:(SCUInteger)count; 01347 01357 - (BOOL)isIncludedIntoSubnetWithStartAddress:(SCIPAddress *)start endAddress:(SCIPAddress *)end; 01358 01368 - (BOOL)isIncludedIntoSubnetWithStartString:(NSString *)start endString:(NSString *)end; 01369 01377 - (BOOL)isIncludedIntoSubnets:(NSArray *)subnets; 01378 01383 - (BOOL)isDivided; 01384 01391 - (BOOL)isDividedWithMask:(SCSubnetMask *)mask; 01392 01399 - (BOOL)isDividedWithString:(NSString *)mask; 01400 01408 - (BOOL)isDividedWithLength:(SCUByte)length; 01409 01416 - (BOOL)isDividedWithPrefix:(NSString *)prefix; 01417 01425 - (BOOL)isDividedWithWildcard:(NSString *)wildcard; 01426 01433 - (BOOL)isDividedWithCount:(SCUInteger)count; 01434 01440 - (BOOL)isDividedWithSubnetsCount:(SCUInteger)count; 01441 01448 - (SCUInteger)subnetsCountWithMask:(SCSubnetMask *)mask; 01449 01457 - (SCUInteger)subnetsCountWithString:(NSString *)mask; 01458 01466 - (SCUInteger)subnetsCountWithLength:(SCUByte)length; 01467 01475 - (SCUInteger)subnetsCountWithPrefix:(NSString *)prefix; 01476 01484 - (SCUInteger)subnetsCountWithWildcard:(NSString *)wildcard; 01485 01493 - (SCUInteger)subnetsCountWithCount:(SCUInteger)count; 01494 01499 - (SCUInteger)maximumSubnets; 01500 01507 - (NSArray *)subnetsWithMask:(SCSubnetMask *)mask; 01508 01515 - (NSArray *)subnetsWithString:(NSString *)mask; 01516 01523 - (NSArray *)subnetsWithLength:(SCUByte)length; 01524 01531 - (NSArray *)subnetsWithPrefix:(NSString *)prefix; 01532 01539 - (NSArray *)subnetsWithWildcard:(NSString *)wildcard; 01540 01547 - (NSArray *)subnetsWithCount:(SCUInteger)count; 01548 01554 - (NSArray *)subnetsWithSubnetsCount:(SCUInteger)count; 01555 01561 - (SCSubnet *)subnetWithMergedSubnet:(SCSubnet *)subnet; 01562 01570 - (SCSubnet *)subnetWithMergedAddress:(SCIPAddress *)address; 01571 01580 - (SCSubnet *)subnetWithMergedAddress:(SCIPAddress *)address mask:(SCSubnetMask *)mask; 01581 01590 - (SCSubnet *)subnetWithMergedAddress:(SCIPAddress *)address maskString:(NSString *)mask; 01591 01600 - (SCSubnet *)subnetWithMergedAddress:(SCIPAddress *)address length:(SCUByte)length; 01601 01610 - (SCSubnet *)subnetWithMergedAddress:(SCIPAddress *)address prefix:(NSString *)prefix; 01611 01620 - (SCSubnet *)subnetWithMergedAddress:(SCIPAddress *)address wildcard:(NSString *)wildcard; 01621 01630 - (SCSubnet *)subnetWithMergedAddress:(SCIPAddress *)address count:(SCUInteger)count; 01631 01639 - (SCSubnet *)subnetWithMergedString:(NSString *)address; 01640 01649 - (SCSubnet *)subnetWithMergedString:(NSString *)address mask:(SCSubnetMask *)mask; 01650 01659 - (SCSubnet *)subnetWithMergedString:(NSString *)address maskString:(NSString *)mask; 01660 01669 - (SCSubnet *)subnetWithMergedString:(NSString *)address length:(SCUByte)length; 01670 01679 - (SCSubnet *)subnetWithMergedString:(NSString *)address prefix:(NSString *)prefix; 01680 01689 - (SCSubnet *)subnetWithMergedString:(NSString *)address wildcard:(NSString *)wildcard; 01690 01699 - (SCSubnet *)subnetWithMergedString:(NSString *)address count:(SCUInteger)count; 01700 01706 - (SCSubnet *)subnetWithMergedSubnets:(NSArray *)subnets; 01707 01717 - (SCSubnet *)subnetWithMergedStartAddress:(SCIPAddress *)start endAddress:(SCIPAddress *)end; 01718 01728 - (SCSubnet *)subnetWithMergedStartString:(NSString *)start endString:(NSString *)end; 01729 01735 - (BOOL)isConnectedWithSubnet:(SCSubnet *)subnet; 01736 01743 - (BOOL)isConnectedWithAddress:(SCIPAddress *)address; 01744 01752 - (BOOL)isConnectedWithAddress:(SCIPAddress *)address mask:(SCSubnetMask *)mask; 01753 01761 - (BOOL)isConnectedWithAddress:(SCIPAddress *)address maskString:(NSString *)mask; 01762 01771 - (BOOL)isConnectedWithAddress:(SCIPAddress *)address length:(SCUByte)length; 01772 01780 - (BOOL)isConnectedWithAddress:(SCIPAddress *)address prefix:(NSString *)prefix; 01781 01790 - (BOOL)isConnectedWithAddress:(SCIPAddress *)address wildcard:(NSString *)wildcard; 01791 01799 - (BOOL)isConnectedWithAddress:(SCIPAddress *)address count:(SCUInteger)count; 01800 01807 - (BOOL)isConnectedWithString:(NSString *)address; 01808 01816 - (BOOL)isConnectedWithString:(NSString *)address mask:(SCSubnetMask *)mask; 01817 01825 - (BOOL)isConnectedWithString:(NSString *)address maskString:(NSString *)mask; 01826 01835 - (BOOL)isConnectedWithString:(NSString *)address length:(SCUByte)length; 01836 01845 - (BOOL)isConnectedWithString:(NSString *)address prefix:(NSString *)prefix; 01846 01855 - (BOOL)isConnectedWithString:(NSString *)address wildcard:(NSString *)wildcard; 01856 01865 - (BOOL)isConnectedWithString:(NSString *)address count:(SCUInteger)count; 01866 01875 - (BOOL)isConnectedWithStartAddress:(SCIPAddress *)start endAddress:(SCIPAddress *)end; 01876 01886 - (BOOL)isConnectedWithStartString:(NSString *)start endString:(NSString *)end; 01887 01894 - (BOOL)isConnectedWithSubnets:(NSArray *)subnets; 01895 01896 #pragma mark - 01897 #pragma mark Classfull and Network Methods 01898 01903 - (BOOL)isClassfull; 01904 01909 - (BOOL)isClassless; 01910 01915 - (NSString *)subnetClass; 01916 01921 - (BOOL)isClassA; 01922 01927 - (BOOL)isClassB; 01928 01933 - (BOOL)isClassC; 01934 01939 - (BOOL)isInternet; 01940 01945 - (BOOL)isSerialLink; 01946 01947 @end
1.7.3