|
NAME"Net::PcapUtils" - Utility routines for Net::Pcap module SYNOPSISrequire Net::Pcap 0.03; use Net::PcapUtils; # Call function for all packets received Net::PcapUtils::loop(\&callbackfn, [optional args]); # Return the next packet available on the interface ($pkt, %hdr) = Net::PcapUtils::next($pcap_t); # Open a network device for processing $pcap_t = Net::PcapUtils::open([optional args]); DESCRIPTIONNet::PcapUtils is a module to sit in front of Net::Pcap in order to hide some of the pcap(3) initialisation by providing sensible defaults. This enables a programmer to easily write small, specific scripts for a particular purpose without having to worry about too many details. The functions implemented in Net::PcapUtils are named after those in Net::Pcap. The loop function sits in a loop and executes a callback for each packet received, while next retrieves the next packet from the network device, and open returns an opened packet descriptor suitable for use with other Net::Pcap routines. Functions
EXAMPLEThe following script prints a message for each IP packet received. #!/usr/bin/perl -w
use strict;
use Net::PcapUtils;
sub process_pkt {
print("packet\n");
}
Net::PcapUtils::loop(\&process_pkt, FILTER => 'ip');
SEE ALSOThe "Net::Pcap" module for XS bindings to the pcap(3) library. The pcap library is available from ftp://ftp.ee.lbl.gov/libpcap.tar.Z COPYRIGHT Copyright (c) 1995,1996,1997,1998,1999 ANU and CSIRO on behalf of
the participants in the CRC for Advanced Computational Systems
('ACSys').
ACSys makes this software and all associated data and documentation
('Software') available free of charge. You may make copies of the
Software but you must include all of this notice on any copy.
The Software was developed for research purposes and ACSys does not
warrant that it is error free or fit for any purpose. ACSys
disclaims any liability for all claims, expenses, losses, damages
and costs any user may incur as a result of using, copying or
modifying the Software.
AUTHORTim Potter <tpot@acsys.anu.edu.au>
|