array_find_key (line
533)
Search the array for a given key and return its value, but using tokenizers
mixed
array_find_key
(mixed $str, array $array, mixed $token, integer $number)
-
mixed
$str: String to look for
-
array
$array: Array where we should look in
-
mixed
$token: Token to use as a separator
-
integer
$number: The number of parts we want to return
array_find_value (line
565)
Search the array for a given value and return it, but using tokenizers
mixed
array_find_value
(mixed $str, array $array, mixed $token, integer $number)
-
mixed
$str: String to look for
-
array
$array: Array where we should look in
-
mixed
$token: Token to use as a separator
-
integer
$number: The number of parts we want to return
array_isearch (line
483)
Perform a case insensitive search for a given value in an array and return its key
mixed
array_isearch
(mixed $str, array $array)
-
mixed
$str: Value to look for
-
array
$array: Array to look in
array_multi_isearch (line
508)
Perform a case insensitive search for a given value in a bi-dimensional array and return its key
mixed
array_multi_isearch
(mixed $str, array $array)
-
mixed
$str: Value to look for
-
array
$array: Array to look in
cascade_delete (line
946)
Delete all references to a MAC address from the FreeNAC tables
void
cascade_delete
(mixed $mac)
-
mixed
$mac: MAC address of the device to delete
clear_mac (line
984)
void
clear_mac
( $mac, $switch)
db_connect (line
380)
Creates a connection to the MySQL database with the parameters defined in config.inc
void
db_connect
()
debug (line
256)
Wrapper around the debug method part of the logger object.
Logs to debug level 1 It will be soon depreciated. Present only for backwards compatibility.
void
debug
(mixed $msg)
-
mixed
$msg: Message to log
debug1 (line
270)
Wrapper around the debug method part of the logger object.
Logs to debug level 1 It will be soon depreciated. Present only for backwards compatibility.
void
debug1
(mixed $msg)
-
mixed
$msg: Message to log
debug2 (line
284)
Wrapper around the debug method part of the logger object.
Logs to debug level 2 It will be soon depreciated. Present only for backwards compatibility.
void
debug2
(mixed $msg)
-
mixed
$msg: Message to log
do_delete (line
852)
Delete a record of the specified table
boolean
do_delete
(mixed $table, mixed $field, mixed $identifier)
-
mixed
$table: Table to delete from
-
mixed
$field: Field to use in the comparation
-
mixed
$identifier: What identifies this device?
getwinsfromip (line
89)
Get WINS Name from IP Address
Original contribution from johnboy68
string
getwinsfromip
(string $ip)
get_last_index (line
188)
Get the last number of an SNMP OID The OID is separated by dots and we use them as a separator.
Example: OID=1.2.3.4.5.6.7.8 Returns: 8
mixed
get_last_index
(mixed $oid)
-
mixed
$oid: OID of interest
get_mysql_info (line
779)
Since we could not reliably count affected rows after mysql operations
see also http://php.net/manual/en/function.mysql-info.php USAGE: $vals = get_mysql_info($linkid); if($vals['rows_matched'] == 0){ mysql_query("INSERT INTO table values('val1','val2', 'valetc')", $linkid); }
void
get_mysql_info
([ $linkid = false])
log2db (line
310)
Write key events to naclog which is visible from the GUI This should NOT be called from a secondary server, i.e.
avoid it in vmpsd_external
void
log2db
(mixed $level, mixed $msg)
-
mixed
$level: Level of severity of the message
-
mixed
$msg: Message to log
log2db3 (line
348)
void
log2db3
( $msg)
logit (line
297)
Wrapper around the logit method part of the logger object.
It will be soon depreciated. Present only for backwards compatibility.
void
logit
(mixed $msg)
-
mixed
$msg: Message to log
mssql_fetch_all (line
737)
Execute query and return assoc array
Assuming a table t1 with 2 Fields Code and Value: $r= mssql_fetch_all("SELECT * from t1") foreach ($r as $row) { $logger->logit("$row[Code], $row[Value]\n");}
mixed
mssql_fetch_all
(mixed $query)
-
mixed
$query: Query to execute
mssql_fetch_one (line
759)
Execute query, fetch one row and return assoc array
mixed
mssql_fetch_one
(mixed $query)
-
mixed
$query: Query to execute
mysql_affected_rows2 (line
806)
void
mysql_affected_rows2
([ $linkid = false])
mysql_fetch_all (line
701)
Execute query and return assoc array
Assuming a table t1 with 2 Fields Code and Value: $r= mysql_fetch_all("SELECT * from t1") foreach ($r as $row) { $logger->logit("$row[Code], $row[Value]\n");
mixed
mysql_fetch_all
(mixed $query)
-
mixed
$query: Query to execute
mysql_fetch_one (line
719)
Execute query, fetch one row and return assoc array
mixed
mysql_fetch_one
(mixed $query)
-
mixed
$query: Query to execute
normalise_mac (line
663)
Normalise mac address format
Get a MAC address from the from XX:XX:XX:XX:XX:XX and convert it to XXXX.XXXX.XXXX
mixed
normalise_mac
(mixed $old_mac)
-
mixed
$old_mac: MAC address to convert
ping_mac (line
424)
void
ping_mac
( $mac)
reformat_mac (line
923)
Reformat a MAC Adress from 0123.2345.2345 to 01:23:23:45:23:45
void
reformat_mac
( $macdot, string $mac)
-
string
$mac: MAC adress of the device (dotted format)
-
$macdot
str_get_last (line
591)
Return the last parts of a tokenized string
mixed
str_get_last
($string $string, $token $token, $number $number)
-
$string
$string: String to split
-
$token
$token: Token to use to split the string
-
$number
$number: How many parts we want to return
syscall (line
403)
Abstract calling of unix commands.
Problem: popen does not pass back command success so syscall cannot say if the command works.
mixed
syscall
(mixed $command)
-
mixed
$command: Command to be executed
telnet_wait_for (line
1120)
void
telnet_wait_for
([ $resource = false], [ $string_to_wait_for = false])
-
$resource
-
$string_to_wait_for
time_diff (line
202)
Returns the difference between 2 dates in secs
mixed
time_diff
(mixed $date1, mixed $date2)
-
mixed
$date1: Date to substract from
-
mixed
$date2: Date
transform_netmask (line
883)
Get the netmask in 255.255.0.0 form
string
transform_netmask
(integer $netmaskbits)
-
integer
$netmaskbits: Bits of the netmask (1-32)
valid_ip (line
59)
Tell if an IPv4 address is valid (well-formed)
void
valid_ip
(string $ip)
-
string
$ip: IP address to test return boolean True if IP address is valid, false otherwise
vlanId2Name (line
159)
Converts a vlan id to a vlan name
mixed
vlanId2Name
(integer $vlanID)
v_sql_1_select (line
636)
Send SQL and expect just one /field/row to return
mixed
v_sql_1_select
(mixed $query)
-
mixed
$query: Query to execute
v_sql_1_update (line
611)
Send SQL and expect just one row to change
mixed
v_sql_1_update
(mixed $query)
-
mixed
$query: Query to execute
write_auth (line
821)
void
write_auth
( $port_id, $system_id, $vlan)
-
$port_id
-
$system_id
-
$vlan
__autoload (line
34)
Load automagically a file containing the class specified by classname
void
__autoload
(object $classname)
-
object
$classname: Class to load