The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

AnyEvent::Pcap::Utils - Utilty class for AnyEvent::Pcap.

SYNOPSIS

  my $a_pcap;
  $a_pcap = AnyEvent::Pcap->new(
      device         => "eth0",
      filter         => "tcp port 80",
      packet_handler => sub {
          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);
  
          # and you can get an IP packet, too.
          my $ip = $a_pcap->utils->extract_ip_packet($packet);
  
          # do something....
      }
  );
        

DESCRIPTION

AnyEvent::Pcap::Utils is a utilty class for AnyEvent::Pcap.

METHODS

new();
extract_tcp_packet([RAW_PACKET])

return NetPacket::TCP object. see NetPacket::TCP.

extract_ip_packet([RAW_PACKET])

return NetPacket::IP object. see NetPacket::IP.

AUTHOR

Takeshi Miki <miki@cpan.org>

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

NetPacket::TCP NetPacket::IP