Packagecom.ericfeminella.net
Classpublic class IPV4Inspector
ImplementsIIPInspector

Provides an API for validating and inspecting an IP version 4 Address (IPv4)

An IP address is 32 bits wide, and is composed of two parts: the network number, and the host number. By convention, it is expressed as four decimal numbers separated by periods, such as "200.1.2.3" representing the decimal value of each of the four bytes. Valid addresses thus range from 0.0.0.0 to 255.255.255.255, a total of about 4.3 billion addresses. The first few bits of the address indicate the Class that the address belongs to:



Protected Properties
 PropertyDefined by
  address : String
IPV4Inspector
  firstOctet : uint
IPV4Inspector
  parts : Array
IPV4Inspector
Public Methods
 MethodDefined by
  
IPV4Inspector(address:String)
Constructor

Creates a new IPv4Inspector instance and validates the IP address specified.

IPV4Inspector
  
getHostOctet():String
Determines the host octet of the specified IP Address
IPV4Inspector
  
getIPAddress():String
Returns the Raw IP Address
IPV4Inspector
  
getNetworkClass():String
Determines the network class of the specified IP Address
  • Class A networks have a beginning octet of 1 - 126
  • Class B networks have a beginning octet of 128-191
  • Class C networks have a beginning octet of 192 - 223
  • Class D networks have a beginning octet of 224 - 239
  • Class E networks have a beginning octet of 240 - 255
    • Class D networks are reserved for multicasting and Class E networks are reserved for "experimental use".

IPV4Inspector
  
Determines the network octet of the specified IP Address
IPV4Inspector
  
isLoopback():Boolean
Determines if the IPAddress is a loopback address.
IPV4Inspector
  
isValid():Boolean
Determines if the address specified is a valid IPv4 address
IPV4Inspector
  
Determines if the IP Address is valid for Network assignment

The entire address range of 224.0.0.0 - 255.255.255.255 is unacceptable for assignment to network hosts, as is any address beginning with 127

IPV4Inspector
  
isWithinClassRange(networkClass:String):Boolean
Determines if the IP Address is within the Class range specified
IPV4Inspector
Property detail
addressproperty
protected var address:String
firstOctetproperty 
protected var firstOctet:uint
partsproperty 
protected var parts:Array
Constructor detail
IPV4Inspector()constructor
public function IPV4Inspector(address:String)

Constructor

Creates a new IPv4Inspector instance and validates the IP address specified. If IP address is not in valid IPv4 format an error is thrown

Parameters
address:String — IP Address in which to validate

Throws
Method detail
getHostOctet()method
public function getHostOctet():String

Determines the host octet of the specified IP Address

Returns
String — the host octet of the specified IP Address
getIPAddress()method 
public function getIPAddress():String

Returns the Raw IP Address

Returns
String — the Raw IP Address
getNetworkClass()method 
public function getNetworkClass():String

Determines the network class of the specified IP Address

getNetworkOctet()method 
public function getNetworkOctet():uint

Determines the network octet of the specified IP Address

Returns
uint — the network octet of the specified IP Address
isLoopback()method 
public function isLoopback():Boolean

Determines if the IPAddress is a loopback address.

An address starting with 127 is a loopback address and should never be used for addressing outside of the host

Returns
Boolean — true if the address is a loopback address, otherwise false
isValid()method 
public function isValid():Boolean

Determines if the address specified is a valid IPv4 address

Returns
Boolean — true if the IP address is a valid IPv4 address, false if not
isValidNetworkHost()method 
public function isValidNetworkHost():Boolean

Determines if the IP Address is valid for Network assignment

The entire address range of 224.0.0.0 - 255.255.255.255 is unacceptable for assignment to network hosts, as is any address beginning with 127

Returns
Boolean — true if the address is valid for network assignment, otherwise false
isWithinClassRange()method 
public function isWithinClassRange(networkClass:String):Boolean

Determines if the IP Address is within the Class range specified

Parameters
networkClass:String

Returns
Boolean — true if the address is within the Class range specified, otherwise false