FreenetIS
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Abstract_Snmp Class Reference

Abstract SNMP library. More...

Inheritance diagram for Abstract_Snmp:
Edgecore_Snmp HP_Snmp Linux_Snmp Mikrotik_Snmp Signamax_Snmp SignamaxOld_Snmp

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

Detailed Description

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.

Author
Ondrej Fibich

Member Function Documentation

Abstract_Snmp::errorHandler (   $errno,
  $errstr,
  $errfile,
  $errline 
)

Handles errors (throws exceptions)

Parameters
int$errno
string$errstr
int$errfile
int$errline
Exceptions
Exception
Abstract_Snmp::getARPMacAddressOf (   $device_ip)
abstract

Obtain MAC address of a device with the given IP address from ARP table.

Parameters
string$device_ipIP address of the device (we would like to know his MAC)
Returns
string MAC address in format xx:xx:xx:xx:xx:xx
Exceptions
ExceptionOn SNMP error or wrong SNMP response
InvalidArgumentExceptionOn 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.

Returns
string The read comunity (e.g. "public")
Abstract_Snmp::getDeviceIp ( )

Gets device IP address.

Returns
string
Abstract_Snmp::getDHCPMacAddressOf (   $device_ip)
abstract

Obtain MAC address of a device with the given IP address from DHCP server.

Parameters
string$device_ipIP address of the device (we would like to know his MAC)
Returns
string MAC address in format xx:xx:xx:xx:xx:xx
Exceptions
ExceptionOn SNMP error or wrong SNMP response
InvalidArgumentExceptionOn wrong IP address

Reimplemented in Mikrotik_Snmp, Linux_Snmp, Edgecore_Snmp, SignamaxOld_Snmp, HP_Snmp, and Signamax_Snmp.

Abstract_Snmp::getPortNumberOf (   $mac_address)
abstract

Obtaint port number with given MAC address.

Parameters
string$mac_addressMAC address of the device (we would like to know to which port is connected)
Returns
string MAC address in format xx:xx:xx:xx:xx:xx
Exceptions
ExceptionOn SNMP error or wrong SNMP response
InvalidArgumentExceptionOn 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.

Returns
int
Abstract_Snmp::getTimeout ( )

Gets the current number of microseconds until the first timeout.

Returns
int
Abstract_Snmp::isCompactibleDriverWith (   $device_ip)
abstract

Checks if the driver is compactible with the driver.

Parameters
string$device_ipDevice IP address
Returns
bool Is compactible?

Reimplemented in Edgecore_Snmp, HP_Snmp, Linux_Snmp, Mikrotik_Snmp, Signamax_Snmp, and SignamaxOld_Snmp.

Abstract_Snmp::setComunity (   $comunity)

Sets the read community.

Parameters
string$comunityThe read comunity (e.g. "public")
Abstract_Snmp::setDeviceIp (   $device_ip)

Sets device IP.

Parameters
string$device_ipNew IP address
Exceptions
InvalidArgumentExceptionIf ip address is invalid
Abstract_Snmp::setRetries (   $retries)

Sets the number of times to retry if timeouts occur.

Parameters
int$retries
Abstract_Snmp::setTimeout (   $timeout)

Sets the number of microseconds until the first timeout.

Parameters
int$timeoutTimeout in microseconds

The documentation for this class was generated from the following file: