CAIDA::Traffic2::FileReader - Reader for Traffic2-style output files.
use CAIDA::Traffic2::FileReader; my $reader = new CAIDA::Traffic2::FileReader(\*STDIN); $reader->set_conversion_options({'as_finder' => $as_finder}); $reader->set_desired_table_types("Tuple Table", "AS Matrix"); while (my $interval = $reader->get_next_interval()) { # Do stuff with $interval }
FileReader is a class that simplifies the reading of Traffic2-style output files. Traffic2-style is that which is output by crl_traffic2 (now named crl_flow). Its interface is simple; simply specify an input source, the table types to be returned to the user, and iterate over all the intervals.
FileReader has the following member functions:
make_src_IP_Table()
will be called. If no tables are set, then all tables
that exist in the input file will be returned.
crl_flow currently only outputs Tuple Tables, but depending on the runtime options, there might be two for one SubinterfaceInfo in a single Interval, a table of expired flows and a table of active flows. These can be requested individually as 'Tuple Table (expired)' or 'Tuple Table (active)', or as a special case, simply 'Tuple Table' will return all that are valid.
At the end of the filehandle, this function returns undef.
The CAIDA::Tables, CAIDA::Traffic2::Interval, CAIDA::Traffic2::SubinterfaceInfo and CAIDA::Traffic2::FileWriter manpages.
crl_flow can output in several different formats than the 'Traffic2' format, which are readable by Interval objects, but cause possibly unexpected behavior. crl_flow allows multiple different expiration algorithms, which can cause the output of multiple entries with the same key. These separate entries will be added together when read by these classes. In addition, 'active' flows are currently ignored entirely.
For best results, use crl_flow -I.
If you have any ideas about how better to deal with this (creating different tables for active and expired flows, creating tables that accept multiple separate entries with the same key), please write us at coral-bugs@caida.org
Ryan Koga <rkoga@caida.org>