NAME
RDR::Collector - Collect RDRv1 packets
VERSION
Version 1.0000
SYNOPSIS
This module is designed to capture and process raw RDR packets from a Cisco SCE series device.
The configuration for the SCE device is very simple and consists of one line of configuration per priority.
An example configuration is shown below
RDR-formatter forwarding-mode multicast
RDR-formatter destination 192.168.1.1 port 33110 category number 1 priority 70
RDR-formatter destination 192.168.1.1 port 33120 category number 2 priority 70
RDR-formatter destination 192.168.1.1 port 33130 category number 3 priority 70
RDR-formatter destination 192.168.1.1 port 33140 category number 4 priority 70
The RDR collector is not designed to accept multiple connections so each priority needs to be sent to a different port. You then need to set up a receiver on 4 different ports (run the example script 4 times) so you can collect the RDRs. In the example above the collecting host is on IP 192.168.1.1. Alternatively if you have multiple SCE devices then you need to configure each one to send to different ports.
An example on how to use this module is shown below. It is relatively simple and sets up a listening port bound to the IP and Port specified.
#!/usr/bin/perl
use strict;
use RDR::Collector;
use IO::File;
my $rdr_client = new RDR::Collector(
[
ServerIP => '192.168.1.1',
ServerPort => '10000',
Timeout => 2,
DataHandler => \&display_data
]
);
# Setup the local RDR listener
my $status = $rdr_client->connect();
# If we could not listen tell us why.
if ( !$status )
{
print "Status was '".$rdr_client->return_status()."'\n";
print "Error was '".$rdr_client->return_error()."'\n";
exit(0);
}
# Now just wait for RDR data.
$rdr_client->check_data_available();
exit(0);
# This routine is called from DataHandler when the module
# instance is initialised.
# 4 parameters are returned, internal ref, remote IP, remote Port and
# the raw data
sub display_data
{
my ( $glob ) = shift;
my ( $remote_ip ) = shift;
my ( $remote_port ) = shift;
my ( $data ) = shift;
my $attribute_line;
my $data_line;
my @keys = keys %{$data};
foreach my $key_name ( @keys )
{
$attribute_line.="$key_name,";
$data_line.=${$data}{$key_name}.",";
}
print "#$attribute_line\n";
print "$data_line\n";
}
This is the most basic way to access the data. There are multiple scripts in the examples directory which will allow you to collect and process the RDR data.
EXPORT
None
FUNCTIONS
new
The parameters for new are below
ServerIP
This is the IP address the client should listen on.
ServerPort
This is the port the client should listen on.
Timeout
This is the amount of time to wait for a TCP timeout. Not entirely sure this
works so do not rely on it.
DataHandler
This should contain a pointer to a user defined function. An example would be
DataHandler => \&display_data
The function should accept for entry points,
$glob - pointer to the internal _GLOBAL variables
$remote_ip - IP address of the connected client
$remote_port - Port of the connected client
$data - hash of the current RDR record
function display_data
{
my ( $glob ) = shift;
my ( $remote_ip ) = shift;
my ( $remote_port ) = shift;
my ( $data ) = shift;
# do something
}
connect
This function attempts to set up the listening socket on the IP and Port specified in the new function. The parameters
ServerIP
ServerPort
Timeout
If the socket can not be setup the function returns 0 and sets error message, if it is successful it return 1.
return_error
This function returns the current error.
check_data_available
This function sets up the listener loop for data on the socket. It calls the user specified function in the new object setup.
AUTHOR
Andrew S. Kennedy, <shamrock at cpan.org>
BUGS
Please report any bugs or feature requests to bug-rdr-collector at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=RDR-Collector. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc RDR::Collector
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
COPYRIGHT & LICENSE
Copyright 2008 Andrew S. Kennedy, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.