- ERROR CODES AND MESSAGES The following error codes and messages are defined:
- LICENSE AND COPYRIGHT
The BGPmon::Fetch::Archive module, to connect to an online archive of BGP files, download XML files and read XML messages one at a time.
The BGPmon::Fetch::Archive module provides functionality to connect to an BGP archive and read one XML message at a time.
use BGPmon::Fetch::Archive; my $ret = init_bgpdata('scratch_dir' => '/tmp/', 'ignore_incomplete_data' => 1, 'ignore_data_errors' => 0); my $ret = connect_archive('archive.netsec.colostate.edu/collectors/bgpdata-netsec/', 1234567890,2345678901); my $xml_msg = read_xml_message(); my $ret = is_connected(); my $num_read = messages_read(); my $num_files = files_read(); my $uptime = uptime(); my $ret = close_connection(); my $downtime = connection_endtime(); my $duration = connection_duration();
init_bgpdata connect_archive read_xml_message close_connection is_connected messages_read files_read uptime connection_endtime connection_duration get_error_code get_error_message get_error_msg
Initializes the scratch directory and error-checking flags for the next archive connection. Input: The location to create a scratch directory in (default is /tmp) Whether to ignore potentially incomplete data (default is to check) Whether to ignore all data errors (must also specify ignore incomplete data flag as well) (default is to check) Output: 0 if initialization fails 1 if initialization succeeds Usage: my $ret = init_bgpdata('scratch_dir' => '/tmp', 'ignore_incomplete_data' => 1, 'ignore_data_errors' => 0);
Connects to an online archive.
Input: archive URL page for some collector (i.e. "archive.netsec.colostate.edu/bgpdata-netsec/") start/end (UNIX timestamps corresponding to the data interval the user wants)
Output: 0 on success, 1 on failure
Usage: my $ret = connect_archive( 'archive.netsec.colostate.edu/collectors/bgpdata-netsec', 1234567890, 2345678901);
Reads the next XML message from the data source that is in the interval.
Input: None, but assumes connect_archive has been called
Output: The next XML message from the archive "stream" or undef
Usage: my $msg = read_xml_message();
Function to close and delete any files and reset the module's state variables
Function to report whether currently connected to an archive.
Get number of messages read.
Usage: my $num_msgs = messages_read();
Get the number of files read.
Usage: my $num_files = files_read();
Returns number of seconds the connection has been up. If the connection is down, return 0.
Usage: my $time = uptime();
Returns the time the connection ended . If the connection is up, return 0.
Usage: my $time = connection_endtime();
Returns the total time the last connection was up for. If the connection is up, returns 0.
NOTE: If a connection is currently established, call uptime().
Usage: my $dur = connection_duration();
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 UNDEFINED_ARGUMENT 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 UNDEFINED_ARGUMENT 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
0: No Error 'No Error' 401: A subroutine was missing an expected argument 'Undefined Argument(s)' 402: There is no active connection to an archive 'Not connected to an archive' 403: There is a currently-active connection to an archive 'Already connected to an archive' 404: The module was unable to find an HTML index page or any download links on the index page 'Unable to find an index page' 405: A system call failed 'System call failed' 406: An invalid value was passed to a subroutine as an argument 'Invalid value given for argument' 407: The connection could not be initialized, either by a failure to set the scratch directory, ignore-error flags, or the first update file could not be loaded. 'Failed to initialize connection to archive' 408: A filesystem 'open' command failed 'File operation failed' 409: There was a failure trying to download a file 'Failed to download file' 410: An invalid XML message was read, or the end of the archive was read 'Invalid message read' 411: An invalid function name was passed to get_error_[code/message/msg] 'Invalid function specified' 412: User tried to ignore all data errors, but was checking for incomplete data 'Cannot have ignore_incomplete_data off with ignore_data_errors on'
<bartletj 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.
Copyright (c) 2012 Colorado State University
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: Archive.pm Authors: Jason Bartlett, Kaustubh Gadkari, Dan Massey, Cathie Olschanowsky Date: 13 Jul 2012