Developer's API Reference guide

Functions

Total number of functions: 6. Functions supported are:

set_error($msg)
et_error_if_unset($msg)
reset_error()
get_string_from_xpath($xml, $xpath, $val, $retVal)
dec_to_bin($decimal, $binary)
get_subnet_bits($ip)

set_error

set_error($msg)

[Since version 0.4.1(-1)]

This private function is used to set the error string to the library. This string can be obtained by libvirt_get_last_error() from the PHP application..

@msg [string]: error message string
Returns: None

et_error_if_unset

et_error_if_unset($msg)

[Since version .4.1(-4)]

unction to set the error only if no other error is set yet.

msg [string]: error message string
Returns: None

reset_error

reset_error()

[Since version 0.4.1(-4)]

Function to reset the error string set by set_error(). Same as set_error(NULL)..

Returns: None

get_string_from_xpath

get_string_from_xpath($xml, $xpath, $val, $retVal)

[Since version 0.4.1(-1)]

Function is used to get the XML xPath expression from the XML document. This can be added to val array if not NULL..

@xml [string]: input XML document
@xpath [string]: xPath expression to find nodes in the XML document
@val [array]: Zend array resource to put data to
@retVal [int]: return value of the parsing
Returns: string containing data of last match found

dec_to_bin

dec_to_bin($decimal, $binary)

[Since version 0.4.1(-1)]

Function dec_to_bin() converts the unsigned long long decimal (used e.g. for IPv4 address) to it's binary representation.

@decimal [int]: decimal value to be converted to binary interpretation
@binary [string]: output binary string with the binary interpretation
Returns: None

get_subnet_bits

get_subnet_bits($ip)

[Since version 0.4.1(-1)]

Function is used to get number of bits used by subnet determined by IP. Useful to get the CIDR IPv4 address representation.

@ip [string]: IP address to calculate subnet bits from
Returns: number of bits used by subnet mask