The BGPmon Client module, to connect to BGPmon and receive XML messages one at a time.
The BGPmon::Client module provides functionality to connect to a bgpmon instance and read one XML message at a time.
use BGPmon::Fetch::Client; my $ret = connect_bgpmon(); set_timeout($time_out_seconds); my $xml_msg = read_xml_message(); my $ret = is_connected(); my $num_read = messages_read(); my $uptime = uptime(); my $ret = close_connection(); my $downtime = connection_endtime();
init_bgpdata connect_bgpmon set_timeout read_xml_message close_connection is_connected messages_read uptime connection_endtime
Initializes the client module. Takes no arguments.
Sets the socket timeout value in seconds. Takes one argument - the timeout value in seconds.
This function connects to the BGPmon server. If the connection succeeds, the function attempts to read the starting <xml> tag from the BGPmon server. If that succeeds, the created socket is returned. If not, the function returns undef.
This function reads one xml message at a time from the BGPmon XML stream.
Function to close open files and sockets.
Function to report whether currently connected to BGPmon.
Get number of messages read.
Returns number of seconds the connection has been up. If the connection is down, return 0.
Returns the time the connection ended . If the connection is up, return 0.
This function reads exactly n bytes from a connection. returns undef on any error or connection close
Get the error code for a given function Input : the name of the function whose error code we should report Output: the function's error code or ARGUMENT_ERROR if the user did not supply a function or INVALID_FUNCTION_SPECIFIED if the user provided an invalid function Usage: my $err_code = get_error_code("connect_archive");
Get the error message of a given function Input : the name of the function whose error message we should report Output: the function's error message or ARGUMENT_ERROR if the user did not supply a function or INVALID_FUNCTION_SPECIFIED if the user provided an invalid function Usage: my $err_msg = get_error_message("read_xml_message");
Shorthand call for get_error_message
<kaustubh at cs.colostate.edu>
Please report any bugs or feature requests to
bgpmon at netsec.colostate.edu, or through the web interface at http://bgpmon.netsec.colostate.edu.
You can find documentation for this module with the perldoc command.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\ File: Client.pm Authors: Kaustubh Gadkari, Dan Massey, Cathie Olschanowsky Date: May 21, 2012