Samond Classes Library 1.1.6-RELEASE build 132

SCIPAddress.h

Go to the documentation of this file.
00001 //
00002 //  SCIPAddress.h
00003 //  scl
00004 //
00005 //  Created by Viacheslav Smolensky on 11.08.09.
00006 //  Copyright (c) 2007 - 2014 by Samond Development Corporation. All rights reserved.
00007 //
00008 
00017 #import <Foundation/Foundation.h>
00018 #import <scl/SCNetObject.h>
00019 #import <scl/SCSubnetMask.h>
00020 
00021 #define SCIPAddressClass @"SCIPAddress" ///< SCIPAddress class name
00022 
00023 #pragma mark -
00024 #pragma mark Predefined IP addresses constants
00025 
00026 #define SC_NET_LOCAL_HOST              @"127.0.0.1"     ///< Local host IP address
00027 
00028 #pragma mark -
00029 
00049 @interface SCIPAddress : SCNetObject {
00050         SCUInteger fAddress; // Internal IP address representation
00051 }
00052 
00053 #pragma mark -
00054 #pragma mark Class properties
00055 #if (__MAC_OS_X_VERSION_MIN_REQUIRED > 1040) || IOS_TARGET
00056 // Address text representation property
00057 @property (nonatomic, retain, getter=address, setter=setAddress:) NSString *address;
00058 // Address internal representation propery
00059 @property (nonatomic, readonly, getter=raw) SCUInteger raw;
00060 // Address class read only property
00061 @property (nonatomic, retain, readonly, getter=addressClass) NSString *addressClass;
00062 // Address class default classfull network mask read only property
00063 @property (nonatomic, retain, readonly, getter=defaultMask) SCSubnetMask *defaultMask;
00064 // Network address for classfull network read only property
00065 @property (nonatomic, retain, readonly, getter=netAddress) SCIPAddress *netAddress;
00066 // Broadcast address for classfull network read only property
00067 @property (nonatomic, retain, readonly, getter=broadcastAddress) SCIPAddress *broadcastAddress;
00068 // First regular address for classfull network read only property
00069 @property (nonatomic, retain, readonly, getter=firstAddress) SCIPAddress *firstAddress;
00070 // Last regular address for classfull network read only property
00071 @property (nonatomic, retain, readonly, getter=lastAddress) SCIPAddress *lastAddress;
00072 #endif
00073 
00074 #pragma mark -
00075 #pragma mark Creating IP Address
00076 
00081 + (SCIPAddress *)emptyAddress;
00082 
00089 + (SCIPAddress *)addressWithString:(NSString *)address;
00090 
00097 + (SCIPAddress *)addressWithAddress:(SCIPAddress *)address;
00098 
00103 + (SCIPAddress *)addressWithLocalHost;
00104 
00110 + (SCIPAddress *)addressWithDataDictionary:(NSDictionary *)dictionary;
00111 
00117 + (SCIPAddress *)addressWithDataDictionaryFromFile:(NSString *)path;
00118 
00124 + (SCIPAddress *)addressWithCoder:(NSCoder *)coder;
00125 
00131 + (SCIPAddress *)addressWithContentsOfSerializedFile:(NSString *)path;
00132 
00140 + (SCIPAddress *)addressWithStream:(SCStream *)stream;
00141 
00148 + (SCIPAddress *)addressWithFileStream:(NSString *)path;
00149 
00150 #pragma mark -
00151 #pragma mark Initializing IP Address
00152 
00157 - (id)init;
00158 
00165 - (id)initWithString:(NSString *)address;
00166 
00173 - (id)initWithAddress:(SCIPAddress *)address;
00174 
00179 - (id)initWithLocalHost;
00180 
00181 #pragma mark -
00182 #pragma mark Changing IP Address
00183 
00189 - (void)setAddress:(NSString *)address;
00190 
00196 - (void)copyAddress:(SCIPAddress *)address;
00197 
00198 #pragma mark -
00199 #pragma mark Querying IP Address
00200 
00205 - (SCUInteger)raw;
00206 
00212 - (SCUByte)octetAtIndex:(SCInteger)index;
00213 
00218 - (SCUByte)firstOctet;
00219 
00224 - (NSString *)address;
00225 
00230 - (NSString *)description;
00231 
00236 - (NSString *)addressClass;
00237 
00242 - (SCSubnetMask *)defaultMask;
00243 
00244 #pragma mark -
00245 #pragma mark Comparing IP Addresses
00246 
00253 - (BOOL)isEqual:(id)address;
00254 
00261 - (BOOL)isEqualToAddress:(SCIPAddress *)address;
00262 
00270 - (BOOL)isEqualToString:(NSString *)address;
00271 
00272 #pragma mark -
00273 #pragma mark Checking IP Address
00274 
00279 - (BOOL)isClassA;
00280 
00285 - (BOOL)isClassB;
00286 
00291 - (BOOL)isClassC;
00292 
00297 - (BOOL)isClassD;
00298 
00303 - (BOOL)isClassE;
00304 
00309 - (BOOL)isLocalHost;
00310 
00315 - (BOOL)isMulticast;
00316 
00321 - (BOOL)isExperimantal;
00322 
00327 - (BOOL)isPrivate;
00328 
00333 - (BOOL)isAddress;
00334 
00335 #pragma mark -
00336 #pragma mark Checking IP Address as a Network Address
00337 
00342 - (BOOL)isNetAddress;
00343 
00350 - (BOOL)isNetAddressWithMask:(SCSubnetMask *)mask;
00351 
00358 - (BOOL)isNetAddressWithMaskString:(NSString *)mask;
00359 
00366 - (BOOL)isNetAddressWithLength:(SCUByte)length;
00367 
00374 - (BOOL)isNetAddressWithPrefix:(NSString *)prefix;
00375 
00382 - (BOOL)isNetAddressWithWildcard:(NSString *)wildcard;
00383 
00390 - (BOOL)isNetAddressWithCount:(SCUInteger)count;
00391 
00392 #pragma mark -
00393 #pragma mark Checking IP Address as a Host Address
00394 
00399 - (BOOL)isHostAddress;
00400 
00407 - (BOOL)isHostAddressWithMask:(SCSubnetMask *)mask;
00408 
00415 - (BOOL)isHostAddressWithMaskString:(NSString *)mask;
00416 
00423 - (BOOL)isHostAddressWithLength:(SCUByte)length;
00424 
00431 - (BOOL)isHostAddressWithPrefix:(NSString *)prefix;
00432 
00439 - (BOOL)isHostAddressWithWildcard:(NSString *)wildcard;
00440 
00447 - (BOOL)isHostAddressWithCount:(SCUInteger)count;
00448 
00449 #pragma mark -
00450 #pragma mark Checking IP Addresses as a Broadcast Address
00451 
00456 - (BOOL)isBroadcast;
00457 
00464 - (BOOL)isBroadcastWithMask:(SCSubnetMask *)mask;
00465 
00472 - (BOOL)isBroadcastWithMaskString:(NSString *)mask;
00473 
00480 - (BOOL)isBroadcastWithLength:(SCUByte)length;
00481 
00488 - (BOOL)isBroadcastWithPrefix:(NSString *)prefix;
00489 
00496 - (BOOL)isBroadcastWithWildcard:(NSString *)wildcard;
00497 
00504 - (BOOL)isBroadcastWithCount:(SCUInteger)count;
00505 
00506 #pragma mark -
00507 #pragma mark Querying Network Address
00508 
00513 - (SCIPAddress *)netAddress;
00514 
00521 - (SCIPAddress *)netAddressWithMask:(SCSubnetMask *)mask;
00522 
00530 - (SCIPAddress *)netAddressWithMaskString:(NSString *)mask;
00531 
00539 - (SCIPAddress *)netAddressWithLength:(SCUByte)length;
00540 
00547 - (SCIPAddress *)netAddressWithPrefix:(NSString *)prefix;
00548 
00555 - (SCIPAddress *)netAddressWithWildcard:(NSString *)wildcard;
00556 
00563 - (SCIPAddress *)netAddressWithCount:(SCUInteger)count;
00564 
00565 #pragma mark -
00566 #pragma mark Querying Broadcast Address
00567 
00572 - (SCIPAddress *)broadcastAddress;
00573 
00580 - (SCIPAddress *)broadcastAddressWithMask:(SCSubnetMask *)mask;
00581 
00589 - (SCIPAddress *)broadcastAddressWithMaskString:(NSString *)mask;
00590 
00598 - (SCIPAddress *)broadcastAddressWithLength:(SCUByte)length;
00599 
00606 - (SCIPAddress *)broadcastAddressWithPrefix:(NSString *)prefix;
00607 
00614 - (SCIPAddress *)broadcastAddressWithWildcard:(NSString *)wildcard;
00615 
00622 - (SCIPAddress *)broadcastAddressWithCount:(SCUInteger)count;
00623 
00624 #pragma mark -
00625 #pragma mark Querying First Reqular Address
00626 
00631 - (SCIPAddress *)firstAddress;
00632 
00640 - (SCIPAddress *)firstAddressWithMask:(SCSubnetMask *)mask;
00641 
00649 - (SCIPAddress *)firstAddressWithMaskString:(NSString *)mask;
00650 
00658 - (SCIPAddress *)firstAddressWithLength:(SCUByte)length;
00659 
00667 - (SCIPAddress *)firstAddressWithPrefix:(NSString *)prefix;
00668 
00676 - (SCIPAddress *)firstAddressWithWildcard:(NSString *)wildcard;
00677 
00685 - (SCIPAddress *)firstAddressWithCount:(SCUInteger)count;
00686 
00687 #pragma mark -
00688 #pragma mark Querying Last Reqular Address
00689 
00695 - (SCIPAddress *)lastAddress;
00696 
00704 - (SCIPAddress *)lastAddressWithMask:(SCSubnetMask *)mask;
00705 
00713 - (SCIPAddress *)lastAddressWithMaskString:(NSString *)mask;
00714 
00722 - (SCIPAddress *)lastAddressWithLength:(SCUByte)length;
00723 
00731 - (SCIPAddress *)lastAddressWithPrefix:(NSString *)prefix;
00732 
00740 - (SCIPAddress *)lastAddressWithWildcard:(NSString *)wildcard;
00741 
00749 - (SCIPAddress *)lastAddressWithCount:(SCUInteger)count;
00750 
00751 @end
 All Classes Files Functions Typedefs Enumerations Enumerator Defines