Overview

Namespaces

  • None
  • PHP

Classes

  • Address
  • AddressGroup
  • AddressRuleContainer
  • AddressStore
  • AggregateEthernetIfStore
  • AggregateEthernetInterface
  • App
  • AppOverrideRule
  • AppRuleContainer
  • AppStore
  • AuthenticationRule
  • CaptivePortalRule
  • cidr
  • Container
  • CsvParser
  • CustomSecurityProfileURL
  • DecryptionProfile
  • DecryptionRule
  • DeviceCloud
  • DeviceGroup
  • DH
  • DoSRule
  • ErrorReporter
  • EthernetIfStore
  • EthernetInterface
  • ExpeditionTaskReporter
  • FawkesConf
  • FileTaskReporter
  • HipObjectsProfile
  • HipProfilesProfile
  • IkeCryptoProfil
  • IkeCryptoProfileStore
  • IKEGateway
  • IKEGatewayStore
  • InterfaceContainer
  • IP4Map
  • IPSecCryptoProfil
  • IPSecCryptoProfileStore
  • IPsecTunnel
  • IPsecTunnelStore
  • LoopbackIfStore
  • LoopbackInterface
  • ManagedDevice
  • ManagedDeviceStore
  • NatRule
  • NetworkPropertiesContainer
  • ObjRuleContainer
  • ObjStore
  • PanAPIConnector
  • PANConf
  • PanoramaConf
  • PbfRule
  • PH
  • PredefinedSecurityProfileURL
  • QoSRule
  • RQuery
  • Rule
  • RuleStore
  • RuleWithUserID
  • Schedule
  • ScheduleStore
  • SecurityProfile
  • SecurityProfileAntiSpyware
  • SecurityProfileAntiVirus
  • SecurityProfileDNSSecurity
  • SecurityProfileFileBlocking
  • SecurityProfileGroup
  • SecurityProfileGroupStore
  • SecurityProfileStore
  • SecurityProfileURL
  • SecurityProfileVirusAndWildfire
  • SecurityProfileVulnerability
  • SecurityProfileWildfire
  • SecurityRule
  • Service
  • ServiceDstPortMapping
  • ServiceGroup
  • ServiceRuleContainer
  • ServiceSrcPortMapping
  • ServiceStore
  • StaticRoute
  • Tag
  • TagRuleContainer
  • TagStore
  • Template
  • TemplateStack
  • TmpInterface
  • TmpInterfaceStore
  • TunnelIfStore
  • TunnelInterface
  • UrlCategoryRuleContainer
  • VirtualRouter
  • VirtualRouterContainer
  • VirtualRouterStore
  • VirtualSystem
  • VirtualWire
  • VirtualWireStore
  • VlanIfStore
  • VlanInterface
  • Zone
  • ZoneRuleContainer
  • ZoneStore

Interfaces

  • TaskReporter

Traits

  • AddressCommon
  • centralAddressStore
  • centralAddressStoreUser
  • centralServiceStore
  • centralServiceStoreUser
  • InterfaceType
  • NegatableRule
  • ObjectWithDescription
  • PanSubHelperTrait
  • PathableName
  • ReferenceableObject
  • RulewithLogging
  • ServiceCommon
  • XmlConvertible

Functions

  • __CmpObjMemID
  • __CmpObjName
  • array_diff_no_cast
  • array_to_devicequery
  • array_unique_no_cast
  • cloneArray
  • convert
  • derr
  • findConnector
  • findConnectorOrDie
  • getDirContents
  • insertAfter
  • lastIndex
  • mdeb
  • mwarning
  • my_shutdown
  • myAutoloader
  • myErrorHandler
  • printn
  • removeElement
  • sortArrayByStartValue
  • yesNoBool
  • Overview
  • Namespace
  • Class
  • Tree

Class cidr

© 2019 Palo Alto Networks, Inc. All rights reserved.

Licensed under SCRIPT SOFTWARE AGREEMENT, Palo Alto Networks, Inc., at https://www.paloaltonetworks.com/legal/script-software-license-1-0.pdf

Located at helper-classes/cidr.php
Methods summary
public static
# cidr2netmask( mixed $cidr )
public static
# ipv4_cidr2netmask( mixed $cidr )
public static
# ipv6_cidr2netmask( mixed $cidr )
public static
# cidr2network( mixed $ip, mixed $cidr )
public static
# ipv4_cidr2network( mixed $ip, mixed $cidr )
public static
# ipv6_cidr2network( mixed $ip, mixed $cidr )
public static
# netmask2cidr( mixed $netmask )
public static
# ipv4_netmask2cidr( mixed $netmask )
public static
# ipv6_netmask2cidr( mixed $netmask )
public static boolean|int[]
# range2network( integer $start, integer $end )

Parameters

$start
integer
$start
$end
integer
$end

Returns

boolean|int[]
FALSE if start/end do not match a network/mask. Otherwise : Array( 'network' => '10.0.0.0', 'mask' => 8, 'string' => '10.0.0.0/8')
public static boolean
# cidr_match( string $ip, string $network, integer $cidr )

Parameters

$ip
string
$ip
$network
string
$network
$cidr
integer
$cidr

Returns

boolean
public static integer
# netMatch( string|int[] $sub, string|int[] $ref )

return 0 if not match, 1 if $sub is included in $ref, 2 if $sub is partially matched by $ref.

return 0 if not match, 1 if $sub is included in $ref, 2 if $sub is partially matched by $ref.

Parameters

$sub
string|int[]
$sub ie: 192.168.0.2/24, 192.168.0.2,192.168.0.2-192.168.0.4
$ref
string|int[]
$ref

Returns

integer
public static &
# stringToStartEnd( mixed $value )
public static &
# IPv6network2StartEnd( mixed $ip )
public static string
# inet_ptoi( string $ip )

Converts human readable representation to a 128 bit int which can be stored in MySQL using DECIMAL(39,0).

Converts human readable representation to a 128 bit int which can be stored in MySQL using DECIMAL(39,0).

Requires PHP to be compiled with IPv6 support. This could be made to work without IPv6 support but I don't think there would be much use for it if PHP doesn't support IPv6.

Parameters

$ip
string
$ip IPv4 or IPv6 address to convert

Returns

string
128 bit string that can be used with DECIMNAL(39,0) or false
public static string
# inet_itop( string $decimal )

Converts a 128 bit int to a human readable representation.

Converts a 128 bit int to a human readable representation.

Requires PHP to be compiled with IPv6 support. This could be made to work without IPv6 support but I don't think there would be much use for it if PHP doesn't support IPv6.

Parameters

$decimal
string
$decimal 128 bit int

Returns

string
IPv4 or IPv6 PROBLEM BY USING IT WITH IPV4 0.X.X.X MAYBE AS NETMASK/WILDCARD AS IT RETURN IPV6
PAN-OS-PHP API documentation generated by ApiGen 2.8.0