Class EndDevice

Description

This class represents a row in the systems table in the database.

In the current version, the host is identified by its mac address. This class extends the Common class.

Located in /lib/EndDevice.php (line 35)

Common
   |
   --EndDevice
Direct descendents
Class Description
 class PortScan This class represents a row in the systems table in the database.
 class WSUSEndDevice This class represents a row in the systems table in the database.
 class SMSEndDevice This class represents a row in the systems table in the database.
Variable Summary
 mixed $db_row
 mixed $mac
Method Summary
 EndDevice __construct (object $object)
 array getAllProps ()
 mixed getEndDeviceID ()
 mixed getVendor ()
 mixed getVlanID ()
 mixed getVlanName ()
 boolean inDB ()
 boolean insertIfUnknown ([ $vlan_to_assign = 0])
 boolean isActive ()
 boolean isExpired ()
 boolean isKilled ()
 boolean isUnknown ()
 boolean isUnmanaged ()
 boolean isVM ()
 boolean postScan ()
 boolean setAlertMessage (mixed $var)
 boolean setAlertSubject (mixed $var)
 boolean setHealth (integer $status)
 boolean setNotifyInfo (mixed $var)
 boolean setOfficeID ([integer $office = 1])
 boolean setPatchInfo (mixed $var)
 boolean setPortID ([integer $port = 0])
 boolean setPortInfo (mixed $var)
 boolean setSwitchInfo (mixed $var)
 boolean setVlanID ([integer $vlan = 1])
 mixed update ()
 mixed __call ( $methodName,  $parameters)
 mixed __get (mixed $key)
 void __set (mixed $key, mixed $value)
Variables
mixed $db_row = array() (line 38)
  • access: protected
mixed $mac (line 37)
  • access: protected

Inherited Variables

Inherited from Common

Common::$conf
Common::$db_conn
Common::$logger
Methods
Constructor __construct (line 46)

The constructor takes the mac address of the system and creates and instance representing that particular system.

Access is read-only.

  • throws: Deny if we received an invalid MAC address or if vlan assigned to this device is 0
  • access: public
EndDevice __construct (object $object)
  • object $object: A copy of the Request

Redefinition of:
Common::__construct()
Get the current instance of our Settings and Logger classes

Redefined in descendants as:
check_calling_method (line 412)

Catch DB inserts.

Check if the function is called from a postconnect method in an object which is a child of Policy. This function should be called from inside the update method. To prevent inserting of code in other methods, new code should be added. This is a basic checking, in the future this code may be enhanced.

  • return: True if function was called from a valid method, false otherwise
boolean check_calling_method ()
getAllProps (line 390)

Return all properties assigned to this system. This method is here only for debugging purposes, please delete it after

  • return: All properties present
  • access: public
array getAllProps ()
getEndDeviceID (line 526)

Get the value of the sid property

  • return: sid
  • access: protected
mixed getEndDeviceID ()
getVendor (line 277)

Return the vendor name associated to first 3 bytes of the mac address

  • return: Vendor for this MAC address
  • access: public
mixed getVendor ()
getVlanID (line 306)

Return the vlan id assigned to this EndDevice

  • return: vid
  • access: public
mixed getVlanID ()
getVlanName (line 297)

Return the Name of the systems' default VLAN

  • return: Default VLAN assigned to this device
  • access: public
mixed getVlanName ()
inDB (line 399)

This method indicates if a system is in the db. This flag was set in the constructor.

  • return: Value of the 'in_db' property
  • access: public
boolean inDB ()
insertIfUnknown (line 535)

Insert an EndDevice if it is not in the DB

  • return: True if something was inserted into the DB, false otherwise
  • access: public
boolean insertIfUnknown ([ $vlan_to_assign = 0])
  • $vlan_to_assign

Redefined in descendants as:
isActive (line 238)

Is this device 'active'?

  • return: Tell if the EndDevice is active
  • access: public
boolean isActive ()
isExpired (line 164)

Check that the system is not yet expired

Expiry date like 0000-00-00 00:00:00 is treated as never expire

  • return: Tell if the system is expired
  • access: public
boolean isExpired ()
isKilled (line 226)

Is this device 'killed'?

  • return: Tell if the EndDevice is killed
  • access: public
boolean isKilled ()
isUnknown (line 250)

Is this device 'unknown'?

  • return: Tell if the EndDevice is unknown
  • access: public
boolean isUnknown ()
isUnmanaged (line 262)

Is this device 'unmanaged'?

  • return: Tell if the EndDevice is unmanaged
  • access: public
boolean isUnmanaged ()
isVM (line 203)

Is this EndDevice a Virtual Machine ?

It is, if the vendor string associated to the first 3 bytes of the mac contains "vmware", "parallels" or "microsoft"

  • return: Tell whether this EndDevice is a Virtual Machine
  • access: public
boolean isVM ()
postScan (line 784)

Set 'scannow' flag in DB, if the machine has a valid IP and wasn't scanned the last 7 days

  • return: True if flag was set, false otherwise
  • access: public
boolean postScan ()
setAlertMessage (line 745)

Set port location information to be used to generate an alert

  • return: True on success
  • access: public
boolean setAlertMessage (mixed $var)
  • mixed $var: Port location information
setAlertSubject (line 727)

Set port location information to be used to generate an alert

  • return: True on success
  • access: public
boolean setAlertSubject (mixed $var)
  • mixed $var: Port location information
setHealth (line 763)

Set the health status for this device

  • return: True if the health status has been changed, false otherwise
  • access: public
boolean setHealth (integer $status)
  • integer $status: Status we want to set this device to
setNotifyInfo (line 708)

Set the Notify information.

This will send an email to the specified users Used for alerting

  • return: True if successful
  • access: public
boolean setNotifyInfo (mixed $var)
  • mixed $var: List of emails to send an alert to
setOfficeID (line 613)

Set the office where this EndDevice is

  • return: True if successful
  • access: public
boolean setOfficeID ([integer $office = 1])
  • integer $office: Office id where this device is. Default is 1
setPatchInfo (line 688)

Set the Patch information where this device is on

Used for alerting

  • return: True if successful
  • access: public
boolean setPatchInfo (mixed $var)
  • mixed $var: Patch information
setPortID (line 594)

Set the port where this EndDevice is on

  • return: True if successful
  • access: public
boolean setPortID ([integer $port = 0])
  • integer $port: Port id where this device is on. Default is 0
setPortInfo (line 650)

Set the Port information where this device is on

Used for alerting

  • return: True if successful
  • access: public
boolean setPortInfo (mixed $var)
  • mixed $var: Port information
setSwitchInfo (line 669)

Set the Switch information where this device is on

Used for alerting

  • return: True if successful
  • access: public
boolean setSwitchInfo (mixed $var)
  • mixed $var: Switch information
setVlanID (line 631)

Set the lastvlan used by this EndDevice

  • return: True if successful
  • access: public
boolean setVlanID ([integer $vlan = 1])
  • integer $vlan: Last vlan id where this device was lastseen. Default is 1
update (line 481)

Update EndDevice information in the DB

  • return: MAC address and hostname of the updated system, or false if no update was performed
  • access: public
mixed update ()
__call (line 321)

Universal Accessor Method We are redirecting all unresolved method calls to this handler, so that we can emulate arbitraty accessor methods.

With this trick, the user can add new fields to the system tables and will be able to access them in the policy as $system->getDBFieldName() without haveing to change this class

  • return: Property
  • throws: If the db field does not exist, Log Error and Deny as default action
  • access: public
mixed __call ( $methodName,  $parameters)
  • $methodName
  • $parameters
__get (line 351)

Get the value of one property if it exists

  • return: The value of the wanted property, or false if such a property doesn't exist
  • access: public
mixed __get (mixed $key)
  • mixed $key: Property to lookup
__set (line 377)

Set the value of one property if it exists

  • throws: Deny if there was an attempt to set an unknown property
  • access: protected
void __set (mixed $key, mixed $value)
  • mixed $key: Property to lookup
  • mixed $value: Value to set the desired property to

Inherited Methods

Inherited From Common

 Common::__construct()
 Common::getConnection()
 Common::htmlescape()
 Common::log2db()
 Common::real_escape_string1()
 Common::sqlescape()

Documentation generated on Mon, 06 Feb 2012 01:10:30 +0100 by phpDocumentor 1.4.0