Abstract SNMP library. More...
Public Member Functions | |
isCompactibleDriverWith ($device_ip) | |
Checks if the driver is compactible with the driver. | |
getARPMacAddressOf ($device_ip) | |
Obtain MAC address of a device with the given IP address from ARP table. | |
getDHCPMacAddressOf ($device_ip) | |
Obtain MAC address of a device with the given IP address from DHCP server. | |
getPortNumberOf ($mac_address) | |
Obtaint port number with given MAC address. | |
getTimeout () | |
Gets the current number of microseconds until the first timeout. | |
setTimeout ($timeout) | |
Sets the number of microseconds until the first timeout. | |
getRetries () | |
Gets the number of times to retry if timeouts occur. | |
setRetries ($retries) | |
Sets the number of times to retry if timeouts occur. | |
getComunity () | |
Gets the read community. | |
setComunity ($comunity) | |
Sets the read community. | |
setDeviceIp ($device_ip) | |
Sets device IP. | |
getDeviceIp () | |
Gets device IP address. | |
errorHandler ($errno, $errstr, $errfile, $errline) | |
Handles errors (throws exceptions) |
Protected Member Functions | |
startErrorHandler () | |
Starts handling PHP errors as Exceptions (if not already started) | |
stopErrorHandler () | |
Stops handling PHP errors as Exceptions (if not alreasy stopped) |
Protected Attributes | |
$timeout = 3000000 | |
$retries = 5 | |
$comunity = 'public' | |
$error_handler_started = FALSE | |
$deviceIp |
Abstract SNMP library.
This class contains all function that are available for each driver.
A driver may be created using Snmp_Factory. Each driver is connected to a single device that is reprezented by it's IP.
Abstract_Snmp::errorHandler | ( | $errno, | |
$errstr, | |||
$errfile, | |||
$errline | |||
) |
Handles errors (throws exceptions)
int | $errno | |
string | $errstr | |
int | $errfile | |
int | $errline |
Exception |
|
abstract |
Obtain MAC address of a device with the given IP address from ARP table.
string | $device_ip | IP address of the device (we would like to know his MAC) |
Exception | On SNMP error or wrong SNMP response |
InvalidArgumentException | On wrong IP address |
Reimplemented in Edgecore_Snmp, SignamaxOld_Snmp, Mikrotik_Snmp, HP_Snmp, Linux_Snmp, and Signamax_Snmp.
Abstract_Snmp::getComunity | ( | ) |
Gets the read community.
Abstract_Snmp::getDeviceIp | ( | ) |
Gets device IP address.
|
abstract |
Obtain MAC address of a device with the given IP address from DHCP server.
string | $device_ip | IP address of the device (we would like to know his MAC) |
Exception | On SNMP error or wrong SNMP response |
InvalidArgumentException | On wrong IP address |
Reimplemented in Mikrotik_Snmp, Linux_Snmp, Edgecore_Snmp, SignamaxOld_Snmp, HP_Snmp, and Signamax_Snmp.
|
abstract |
Obtaint port number with given MAC address.
string | $mac_address | MAC address of the device (we would like to know to which port is connected) |
Exception | On SNMP error or wrong SNMP response |
InvalidArgumentException | On wrong IP address |
Reimplemented in Mikrotik_Snmp, Linux_Snmp, Edgecore_Snmp, HP_Snmp, SignamaxOld_Snmp, and Signamax_Snmp.
Abstract_Snmp::getRetries | ( | ) |
Gets the number of times to retry if timeouts occur.
Abstract_Snmp::getTimeout | ( | ) |
Gets the current number of microseconds until the first timeout.
|
abstract |
Checks if the driver is compactible with the driver.
string | $device_ip | Device IP address |
Reimplemented in Edgecore_Snmp, HP_Snmp, Linux_Snmp, Mikrotik_Snmp, Signamax_Snmp, and SignamaxOld_Snmp.
Abstract_Snmp::setComunity | ( | $comunity | ) |
Sets the read community.
string | $comunity | The read comunity (e.g. "public") |
Abstract_Snmp::setDeviceIp | ( | $device_ip | ) |
Sets device IP.
string | $device_ip | New IP address |
InvalidArgumentException | If ip address is invalid |
Abstract_Snmp::setRetries | ( | $retries | ) |
Sets the number of times to retry if timeouts occur.
int | $retries |
Abstract_Snmp::setTimeout | ( | $timeout | ) |
Sets the number of microseconds until the first timeout.
int | $timeout | Timeout in microseconds |