CAIDA::Traffic2::SubinterfaceInfo - Storage/reading object for subinterfaces


    use CAIDA::Traffic2::FileReader;
    # Set up $reader and $interval with initialization data
    my @id_infos = $interval->get_id_infos();
    my @types = $id_infos[0]->get_table_types();
    my @exist_types = $id_infos[0]->get_existing_types();
    my $ip_not_v4 = $id_infos[0]->get_metadata('ip not v4');
    $id_infos[0]->set_metadata('ip not v4', 10);
    my $table = $interval->get_table($id_infos[0], $types[0]);
    my $accumulator = new CAIDA::Traffic2::SubinterfaceInfo;


SubinterfaceInfo is a class that assists in the reading of Traffic2-style output files. Traffic2-style is that which is output by crl_traffic2 (now named crl_flow). There is no need to create a SubinterfaceInfo object explicitly, as they are created by Interval objects. It also contains the actual table data in a file, even though the accessor function (get_table()) is a member function of the Interval class. SubinterfaceInfo also stores information about subinterfaces (for example, for an ATM interface, a subinterface could be a particular vp/vc pair), such as the number of packets/bytes/flows in the subinterface, or the timestamps of the first and latest flow seen.

SubinterfaceInfo has the following member functions:

new ()
Creates a new SubinterfaceInfo object.

This should not be necessary to any applications programmer.

get_table_types ()
Returns the tables requested by the user (in FileReader). However, they will be ordered in such a way as to make incremental reading more efficient. These should be used by Interval::get_table().

get_existing_types ()
Returns the tables which are stored in the SubinterfaceInfo object. Only useful when all the tables have been preloaded.

get_metadata (FIELD)
Returns metadata related to the subinterface. FIELD is the name of the specific piece of metadata. Valid FIELD values are:
The name of the subinterface. (eg: 'if 0 1:1234')

unknown encapsulation
The amount of packets found whose encapsulation were unknown to crl_flow.

ip not v4
The amount of IP packets found which were not IP version 4.

The amount of (IPv4) packets.

The amount of (IPv4) bytes.

The amount of (IPv4) flows.

The timestamp of the first (IPv4) packet seen.

The timestamp of the latest (IPv4) packet seen.

set_metadata (FIELD, VALUE)
Sets and returns metadata related to the subinterface. FIELD is the name of the specific piece of metadata, as listed above, and VALUE is the new value.

Adds another SUBINTERFACEINFO to the current one. This assumes that SUBINTERFACEINFO has been properly initialized (ie, created via FileReader). It also assumes that the two objects are contiguous in time, and that they have been preloaded. nadd() is the same as add(), but it is free to do destructive operations on SUBINTERFACEINFO. SUBINTERFACEINFO should not be used again for anything after calling nadd().

These functions should not be necessary to any applications programmer.





The CAIDA::Tables, CAIDA::Traffic2::Interval, CAIDA::Traffic2::FileWriter and CAIDA::Traffic2::FileReader 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






Ryan Koga <>