The contents of this legacy page are no longer maintained nor supported, and are made available only for historical purposes.

Documentation for the Perl CRL API


Mini-guide to CRL.pm

Welcome to the CRL library! This Perl module gives users access to the C coral library, but with the convenience of Perl. By using SWIG (the Simplified Wrapper and Interface Generator), C functions are wrapped and accessible from Perl. It consists of two interfaces to C functions, as well as various useful Perl functions. These two C libraries are Unpack and Coral:

The Unpack library provides a perl interface to some basic C structures, specifically packet headers, as well as for Coral-specific structures. It exists because the perl method of extracting headers is too inefficient for a tight loop (in that it requires one to extract every possible field from a header, even when unwanted). With the magic of SWIG, the C code to select certain fields from these headers is easily accessible from perl.

The Coral library is a simple wrapper around calls to the libcoral API. You must first compile libcoral before you can compile the (Perl) Coral library. However, if you don't want to program in C, then you should not have to worry too much about it after that.

These libraries should be built automatically with a top-level build. In order to use the CRL library within your Perl scripts, you need only put "use CRL;" in them, but your scripts will have to be able to find the file CRL.pm. If CRL.pm is in another directory, you will need to use "use lib '/coral_dir/lib';" (for example).

Usage:

Example:

This program uses many of the main features of the Coral and Unpack libraries.
crl_sample.pl trace.file (please provide your own traces)

For more information on generating perl/C wrappers, look at: http://www.swig.org
You may find many traces at: http://moat.nlanr.net/Traces/


Problems? Write us:
coral-bugs@caida.org

Related Objects

See https://catalog.caida.org/details/software/coralreef/ to explore related objects to this document in the CAIDA Resource Catalog.