Skip to content

Commit

Permalink
stats seems to work
Browse files Browse the repository at this point in the history
  • Loading branch information
jettero committed Jun 7, 2011
1 parent 6687360 commit f9fe383
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 10 additions & 1 deletion Easy.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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.