Permalink
Browse files

stats seems to work

  • Loading branch information...
jettero committed Jun 7, 2011
1 parent 6687360 commit f9fe38328f57a00cb5e7e8f26a0b8857f477b9aa
Showing with 13 additions and 1 deletion.
  1. +3 −0 Changes
  2. +10 −1 Easy.pm
View
@@ -1,3 +1,6 @@
+1.4207: Tue Jun 07 2011
+ - added ->stats()
+
1.4205: Fri Jul 30 2010
- accepted a patch from Jerry Litteer
- added tcp to the synopsis and examples/synopsis.pl
View
11 Easy.pm
@@ -16,7 +16,7 @@ use NetPacket::UDP;
use NetPacket::IGMP;
use NetPacket::ICMP qw(:types);
-our $VERSION = "1.4205";
+our $VERSION = "1.4207";
our $MIN_SNAPLEN = 256;
our $DEFAULT_PPL = 32;
@@ -247,5 +247,14 @@ sub cidr {
return $nm;
}
+sub stats {
+ my $this = shift;
+
+ my %stats;
+ Net::Pcap::pcap_stats($this->{pcap}, \%stats);
+ $stats{ substr $_, 3 } = delete $stats{$_} for keys %stats;
+
+ return wantarray ? %stats : \%stats;
+}
1;

0 comments on commit f9fe383

Please sign in to comment.