Registry.php

Show: inherited
Table of Contents
RouterOS API client implementation.

RouterOS is the flag product of the company MikroTik and is a powerful router software. One of its many abilities is to allow control over it via an API. This package provides a client for that API, in turn allowing you to use PHP to control RouterOS hosts.

PHP version 5

Author
Vasil Rangelov  
Category
Net  
Copyright
2011 Vasil Rangelov  
License
LGPL License 2.1  
Link
http://pear2.php.net/PEAR2_Net_RouterOS  
Package
PEAR2_Net_RouterOS  
Version
1.0.0b3  

\PEAR2\Net\RouterOS\Registry

Package: PEAR2\Net\RouterOS
A RouterOS registry.

Provides functionality for managing the request/response flow. Particularly useful in persistent connections.

Author
Vasil Rangelov  
Category
Net  
License
LGPL License 2.1  
Link
http://pear2.php.net/PEAR2_Net_RouterOS  

Properties

Propertyprotectedint $instanceId

ID of instance within the request.

Details
Type
int
Propertyprotectedint $instanceIdSeed = -1
static

ID to be given to next instance, after incrementing it.

Default value-1Details
Type
int
Propertyprotectedint $requestId = -1
static

ID of request. Populated at first instance in request.

Default value-1Details
Type
int
Propertyprotected\PEAR2\Cache\SHM $shm

The storage.

Details
Type
\PEAR2\Cache\SHM

Methods

methodpublic__construct(string $uri) : void

Creates a registry.

Parameters
Name Type Description
$uri string

An URI to bind the registry to.

methodpublic__destruct() : void

Removes this instance's buffer.

methodprivate_add(\PEAR2\Net\RouterOS\Response $response, \PEAR2\Net\RouterOS\type $targetBufferName) : void

Adds a response to a buffer.

Parameters
Name Type Description
$response \PEAR2\Net\RouterOS\Response

The response to add.

$targetBufferName \PEAR2\Net\RouterOS\type

The name of the buffer to add the response to.

methodprivate_close(string $targetBufferName) : void

Removes a buffer.

Parameters
Name Type Description
$targetBufferName string

The buffer to remove.

methodpublicadd(\PEAR2\Net\RouterOS\Response $response, string $ownershipTag) : bool

Add a response to the registry.

Parameters
Name Type Description
$response \PEAR2\Net\RouterOS\Response

The response to add. The caller of this function is responsible for ensuring that the ownership tag and the original tag are separated, so that only the original one remains in the response.

$ownershipTag string

The ownership tag that the response had.

Returns
Type Description
bool TRUE if the request was added to its buffer, FALSE if this instance owns the response, and therefore doesn't need to add the response to its buffer.
methodpublicclose() : void

Closes the registry.

Closes the registry, meaning that all buffers are cleared.

methodpublicgetNextResponse() : \PEAR2\Net\RouterOS\Response | null

Gets the next response from this instance's buffer.

Returns
Type Description
\PEAR2\Net\RouterOS\Response | null The next response, or NULL if there isn't one.
methodpublicgetOwnershipTag() : string

Get the ownership tag for this instance.

Returns
Type Description
string The ownership tag for this registry instance.
methodpublicisTaglessModeOwner() : bool

Checks if this instance is the tagless mode owner.

Returns
Type Description
bool TRUE if this instance is the tagless mode owner, FALSE otherwise.
methodpublicparseTag(string $tag) : array
static

Parses a tag.

Parses a tag to reveal the ownership part of it, and the original tag.

Parameters
Name Type Description
$tag string

The tag (as received) to parse.

Returns
Type Description
array An array with the first member being the ownership tag, and the second one being the original tag.
methodpublicsetTaglessMode(bool $taglessMode) : bool

Sets the "tagless mode" setting.

While in tagless mode, this instance will claim owhership of any responses without a tag. While not in this mode, any requests without a tag will be given to all instances.

Regardless of mode, if the type of the response is Response::TYPE_FATAL, it will be given to all instances.

Parameters
Name Type Description
$taglessMode bool

TRUE to claim tagless ownership, FALSE to release such ownership, if taken.

Returns
Type Description
bool TRUE on success, FALSE on failure.
Documentation was generated by phpDocumentor 2.0.0a8.