Changeset 874 for trunk/Packages/Common/NetworkAddress.php
- Timestamp:
- Apr 6, 2020, 11:56:19 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/NetworkAddress.php
r873 r874 16 16 function GetNetMask() 17 17 { 18 return (( (1 << IPV4_BIT_WIDTH) - 1) ^ ((1 << (IPV4_BIT_WIDTH - $this->Prefix)) - 1));18 return ((1 << IPV4_BIT_WIDTH) - 1) ^ ((1 << (IPV4_BIT_WIDTH - $this->Prefix)) - 1); 19 19 } 20 20 21 21 function AddressToString() 22 22 { 23 return (implode('.', array(($this->Address >> 24) & 255, ($this->Address >> 16) & 255, ($this->Address >> 8) & 255, ($this->Address & 255))));23 return implode('.', array(($this->Address >> 24) & 255, ($this->Address >> 16) & 255, ($this->Address >> 8) & 255, ($this->Address & 255))); 24 24 } 25 25 … … 39 39 $To->Address = $From->Address + $HostMask; 40 40 $To->Prefix = IPV4_BIT_WIDTH; 41 return (array('From' => $From, 'To' => $To));41 return array('From' => $From, 'To' => $To); 42 42 } 43 43 … … 55 55 if (($this->Prefix < $Address->Prefix) and (($Address->Address & $UpperNetmask) == ($this->Address & $UpperNetmask))) $Result = true; 56 56 else $Result = false; 57 return ($Result);57 return $Result; 58 58 } 59 59 } … … 74 74 function GetNetMask() 75 75 { 76 return (Int128Xor(Int128Sub(Int128Shl(IntToInt128(1), IntToInt128(IPV6_BIT_WIDTH)), IntToInt128(1)),77 Int128Sub(Int128Shl(IntToInt128(1), IntToInt128(IPV6_BIT_WIDTH - $this->Prefix)), IntToInt128(1))) );76 return Int128Xor(Int128Sub(Int128Shl(IntToInt128(1), IntToInt128(IPV6_BIT_WIDTH)), IntToInt128(1)), 77 Int128Sub(Int128Shl(IntToInt128(1), IntToInt128(IPV6_BIT_WIDTH - $this->Prefix)), IntToInt128(1))); 78 78 } 79 79 80 80 function AddressToString() 81 81 { 82 return (inet_ntop($this->Address));82 return inet_ntop($this->Address); 83 83 } 84 84 … … 106 106 $Result[] = dechex(($Item >> 4) & 15); 107 107 } 108 return ($Result);108 return $Result; 109 109 } 110 110 … … 129 129 if (($this->Prefix < $Address->Prefix) and ((Int128Equal(Int128And($Address->Address, $UpperNetmask), Int128And($this->Address, $UpperNetmask))))) $Result = true; 130 130 else $Result = false; 131 return ($Result);131 return $Result; 132 132 } 133 133 }
Note:
See TracChangeset
for help on using the changeset viewer.