API - XOOPS 2.5.11 Beta 2
By monxoops.fr
IPAddress Class Reference

Public Member Functions

 __construct ($ip)
 
 asReadable ()
 
 asBinary ()
 
 ipVersion ()
 
 sameSubnet ($matchIp, $netMask4, $netMask6)
 

Static Public Member Functions

static fromRequest ()
 

Protected Member Functions

 normalize ($ip)
 
 asBinaryString (IPAddress $ip)
 

Protected Attributes

 $ip
 

Constructor & Destructor Documentation

◆ __construct()

__construct (   $ip)

IPAddress constructor.

Parameters
string$ipIP address

Member Function Documentation

◆ asBinary()

asBinary ( )

get network (binary) form of address

Returns
string|false

◆ asBinaryString()

asBinaryString ( IPAddress  $ip)
protected

Convert an IP address to a binary character string (i.e. "01111111000000000000000000000001")

Parameters
IPAddress$ipaddress object
Returns
string

◆ asReadable()

asReadable ( )

return presentation form of address

Returns
string|false

◆ fromRequest()

static fromRequest ( )
static

Get IP address from the request server data

Returns
IPAddress
Here is the caller graph for this function:

◆ ipVersion()

ipVersion ( )

get the ip version, 4 or 6, of address

Returns
int|false integer 4 for IPV4, 6 for IPV6, or false if invalid

◆ normalize()

normalize (   $ip)
protected

convert IP address into a normalized condensed notation

Parameters
string$ipip address to normalize
Returns
string|false normalized address or false on failure

◆ sameSubnet()

sameSubnet (   $matchIp,
  $netMask4,
  $netMask6 
)

Is this IP in the same subnet as the supplied address?

Accepts net masks for both IPV4 and IPV6 and will select the appropriate one, to allow checking policy against request input with minimal method calls.

Parameters
string$matchIppresentation form ip address to compare
int$netMask4network mask, bits to match <= 32 for IPV4
int$netMask6network mask, bits to match <=128 for IPV6
Returns
bool true if $this->ip and $matchIp are both in the specified subnet

Field Documentation

◆ $ip

$ip
protected

The documentation for this class was generated from the following file: