NAME
AnyEvent::Pcap - Net::Pcap wrapper with AnyEvent
SYNOPSIS
use AnyEvent::Pcap;
my $a_pcap;
$a_pcap = AnyEvent::Pcap->new(
    device         => "eth0",
    filter         => "tcp port 80",
    timeout        => 1000,
    packet_handler => sub {
        my $io     = pop;
        while (@_) {
            my $header = shift;
            my $packet = shift;
            # you can use utils to get an NetPacket::TCP object.
            my $tcp = $a_pcap->utils->extract_tcp_packet($packet);
            # or ...
            $tcp = AnyEvent::Pcap::Utils->extract_tcp_packet($packet); 
            # do something....
        }
    }
);
$a_pcap->run();
AnyEvent->condvar->recv;
DESCRIPTION
AnyEvent::Pcap is a Net::Pcap wrapper on top of AnyEvent.
Also you can use its utils to get NetPacket::IP or NetPacket::TCP object.
METHODS
- new([%args]);
 - 
my %args = ( # Default device is selected with Net::Pcap::pcap_lookupdev() device => "eth0", # It also could be "file:/path/to/file" to load a saved dump device => "file:samples/ping-ietf-20pk-le.dmp", # Default filter is NULL filter => "tcp port 80", # How much milliseconds to wait before flushing pcap buffer # Default is 0 (unlimited) timeout => 1000, # Reference to your callback packet_handler => sub { # The last item is AE::io handler my $io = pop; # Other items are pairs of ($header, $packet) while (@_) { my $header = shift; my $packet = shift; ... } } ); my $a_pcap = AnyEvent::Pcap->new(%args);Create and return new AnyEvent::Pcap object.
 - utils()
 - 
my $a_pcap = AnyEvent::Pcap->new; my $utils = $a_pcap->utils;You can get a utilty for packet handling. See AnyEvent::Pcap::Utils.
 - run()
 - 
my $a_pcap = AnyEvent::Pcap->new(%args); $a_pcap->run; AnyEvent->condvar->recv;Running AnyEvent loop.
 
accessor methods
AUTHOR
Takeshi Miki <miki@cpan.org>
CONTRIBUTORS
Sébastien Aperghis-Tramoni <sebastien at aperghis.net>
Sergei Zhmylev <zhmylove@cpan.org>
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.