Registry.phpView Source

Show: PublicProtectedPrivateinherited
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.0b4  

\PEAR2\Net\RouterOS\Registry

Package: PEAR2_Net_RouterOS
A RouterOS registry.
Provides functionality for managing the request/response flow. Particularly useful in persistent connections. Note that this class is not meant to be called directly.
Author
Vasil Rangelov  
Category
Net  
License
LGPL License 2.1  
Link
http://pear2.php.net/PEAR2_Net_RouterOS  

Properties

>VPropertyprotectedint $instanceId

ID of instance within the request.

Details
Type
int
>VPropertyprotectedint $instanceIdSeed = -1
static

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

Default value-1Details
Type
int
>VPropertyprotectedint $requestId = -1
static

ID of request. Populated at first instance in request.

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

The storage.

Details
Type
\PEAR2\Cache\SHM

Methods

methodpublic__construct(string $uri) : void

Creates a registry.

Parameters
NameTypeDescription
$uristring

An URI to bind the registry to.

methodpublic__destruct() : void

Removes this instance's buffer.

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

Adds a response to a buffer.

Parameters
NameTypeDescription
$response\PEAR2\Net\RouterOS\Response

The response to add.

$targetBufferNamestring

The name of the buffer to add the response to.

methodprivate_close(string $targetBufferName) : void

Removes a buffer.

Parameters
NameTypeDescription
$targetBufferNamestring

The buffer to remove.

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

Add a response to the registry.

Parameters
NameTypeDescription
$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.

$ownershipTagstring

The ownership tag that the response had.

Returns
TypeDescription
boolTRUE 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
TypeDescription
\PEAR2\Net\RouterOS\Response | nullThe next response, or NULL if there isn't one.
methodpublicgetOwnershipTag() : string

Get the ownership tag for this instance.

Returns
TypeDescription
stringThe ownership tag for this registry instance.
methodpublicisTaglessModeOwner() : bool

Checks if this instance is the tagless mode owner.

Returns
TypeDescription
boolTRUE 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
NameTypeDescription
$tagstring

The tag (as received) to parse.

Returns
TypeDescription
arrayAn 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 {@link Response::TYPE_FATAL}, it will be given to all instances.
Parameters
NameTypeDescription
$taglessModebool

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

Returns
TypeDescription
boolTRUE on success, FALSE on failure.
Documentation was generated by phpDocumentor 2.1.0-DEV .