\DeviceAtlas\CarrierBucketHandler

A bucket is a section of the data file. It has an ID, length and a byte array of data. Each bucket type has a specific format. This class handles the conversion of bucket data(binary bytes) to actual values.

The following buckets are handled:

  • Property Names - a unique list of property names. The order is the index.
  • Property Values - a unique list of property values. The order is the index.
  • Properties - collections of property name IDs to property value IDs
  • IPv4 Radix Tree - contains the data for the left/right branches of a tree and property collection IDs

The bucket handler expects the buckets to be in the above order.

Summary

Methods
Properties
Constants
getName()
needsBuckets()
getTreeLefts()
getTreeRights()
getTreeProperties()
getPropertyNames()
getPropertyNamesAsStrings()
processBucket()
No public properties found
BOOLEAN
BYTE
SHORT
INTEGER
LONG
FLOAT
DOUBLE
STRING
UNKNOWN
NO_VALUE
NO_CONTAINER
ORDER_SET_CONTAINER
No protected methods found
No protected properties found
N/A
processPropertyNamesBucket()
processPropertyValuesBucket()
processPropertiesBucket()
processIpv4TreeBucket()
getPropertyValue()
$names
$CRC32_DOES_NOT_MATCH
$propertyNames
$propertyStringNames
$propertyValues
$properties
$treeLefts
$treeRights
$treeProperties
N/A

Constants

BOOLEAN

BOOLEAN = 0

Type boolean

BYTE

BYTE = 1

Type byte

SHORT

SHORT = 2

Type short int

INTEGER

INTEGER = 3

Type int

LONG

LONG = 4

Type long int

FLOAT

FLOAT = 5

Type float

DOUBLE

DOUBLE = 6

Type double

STRING

STRING = 7

Type string

UNKNOWN

UNKNOWN = 8

Unknown type

NO_VALUE

NO_VALUE = -1

for internal api use

NO_CONTAINER

NO_CONTAINER = 0

for internal api use

ORDER_SET_CONTAINER

ORDER_SET_CONTAINER = 1

for internal api use

Properties

$names

$names : 

Maps data types to data type names array {byte: string}

Type

$CRC32_DOES_NOT_MATCH

$CRC32_DOES_NOT_MATCH : 

CRC Error message

Type

$propertyNames

$propertyNames : 

[PropertyName]

Type

$propertyStringNames

$propertyStringNames : 

[string]

Type

$propertyValues

$propertyValues : 

[Property]

Type

$properties

$properties : 

[Properties]

Type

$treeLefts

$treeLefts : 

[int]

Type

$treeRights

$treeRights : 

[int]

Type

$treeProperties

$treeProperties : 

[Properties]

Type

Methods

getName()

getName(  $dataTypeID) : string

Parameters

$dataTypeID

int The id to lookup the name for

Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

Returns

string —

The name of the data type.

needsBuckets()

needsBuckets() : boolean

Checks if all the necessary buckets have been supplied and processed.

Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

Returns

boolean —

true if all buckets complete, FALSE otherwise

getTreeLefts()

getTreeLefts() : array

Returns the Radix Trie "left" pointers

Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

Returns

array —

Radix Trie "left" pointers

getTreeRights()

getTreeRights() : array

Returns the Radix Trie "right" pointers

Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

Returns

array —

Radix Trie "right" pointers

getTreeProperties()

getTreeProperties() : array

Returns the properties used in the Radix Trie nodes

Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

Returns

array —

Radix Trie nodes

getPropertyNames()

getPropertyNames() : \DeviceAtlas\Carrier\[PropertyNames]

Returns the property names array

Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

Returns

\DeviceAtlas\Carrier\[PropertyNames]

getPropertyNamesAsStrings()

getPropertyNamesAsStrings() : \DeviceAtlas\Property

Returns the property names array

Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

Returns

\DeviceAtlas\Property

names as string

processBucket()

processBucket(  $bucketId,   $fileCrc32,   $bucketData) 

Process a bucket identified by "bucketId". The bucket CRC-32 hash is verified before parsing the bucket data.

Parameters

$bucketId
$fileCrc32
$bucketData

Throws

\DeviceAtlas\Exception\DataLoadingException

processPropertyNamesBucket()

processPropertyNamesBucket(  $data) 

The following is the structure of this bucket: <pre> 2B Num of indexed items <repeating> 1B data type of property value 1B length of name ?B property name - ascii string </repeating> </pre> The order of the properties is taken as the index for each item.

Parameters

$data
Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

processPropertyValuesBucket()

processPropertyValuesBucket(  $data) 

The following is the structure of this bucket: <pre> 2B Number of indexed items <repeating>

1B container type ID: "no container", "ordered set" etc

1B property type - int, boolean, string etc 1B/2B/4B length of value bytes --OPTIONAL-- (only applies to some string types) ?B the converted value, some data types have a fixed length such as (boolean len=1, byte len=1, short len=2, int len=4, float len=4)
<elseif container="ordered set">
  1B   property type - int, boolean, string etc
  2B   number of items in the set
  <repeat>
    <if type=string>
      1B        property type - the type of string -
      1B/2B/4B  length of value bytes --OPTIONAL-- (only applies to some string types)
    </if>
    ?B   the converted value, some data types have a fixed length such as (boolean len=1, byte len=1, short len=2, int len=4, float len=4)
  </repeat>
</if>

2B Num of indexed items

1B property type <1B/2B/4B> length of value bytes --OPTIONAL-- ?B the converted value, some data types have a fixed length such as (bool len=1, byte len=1, short len=2, int len=4, float len=4)

The order of the items is taken as the index for each item.

Parameters

$data
Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

processPropertiesBucket()

processPropertiesBucket(  $data) 

The following is the structure of this bucket: <pre> 2B Num of indexed items <repeating> 2B num items in collection <repeating> 4B property name ID 4B property value ID </repeating> </repeating> </pre> The order of the properties is taken as the index for each item. As each item of the collection is loaded it is looked up in the previously loaded property names and property values IDs.

Parameters

$data

Throws

\DeviceAtlas\Carrier\IOException

processIpv4TreeBucket()

processIpv4TreeBucket(  $data) 

Load the data for the IPv4 Tree bucket. This bucket has the following structure: <pre> These 3 ints repeat for the entire bucket: <repeating> 4B properties ID value 4B Left value 4B Right value </repeating> </pre>

Parameters

$data
Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

getPropertyValue()

getPropertyValue(  $dataType,   $reader) : mixed

Read the appropriate property from the ByteReader depending on the data type. All of the primitive types are fixed length. In addition there are five fixed length UTF8 string values and other special types for strings that are less than certain lengths.

Parameters

$dataType
$reader
Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

Returns

mixed —

Property value