libpoe-component-pcap-perl-0.04/0000755000175000017500000000000011221131714015555 5ustar cajuscajuslibpoe-component-pcap-perl-0.04/MANIFEST0000644000175000017500000000021410747355275016731 0ustar cajuscajus# $Id: MANIFEST,v 1.1.1.1 2001/02/16 14:35:51 fletch Exp $ CHANGES Pcap.pm MANIFEST Makefile.PL README t/01basic.t eg/ArpWatch.pm eg/awtest libpoe-component-pcap-perl-0.04/t/0000755000175000017500000000000011221131714016020 5ustar cajuscajuslibpoe-component-pcap-perl-0.04/t/01basic.t0000644000175000017500000000451110747355275017456 0ustar cajuscajus#!/usr/bin/perl ## ## 01basic.t -- Basic testing. Watches for a single ARP packet ## use strict; use Test; BEGIN { plan tests => 2, } use POE; use Net::Pcap (); use NetPacket::Ethernet qw( :types ); use NetPacket::ARP qw( :opcodes ); use POE::Component::Pcap; if( $> ) { print <create( inline_states => { _start => \&start, _stop => sub { $_[KERNEL]->post( pcap => 'shutdown' ) }, got_packet => \&got_packet, # _signal => \&_signal, }, ); $poe_kernel->run; exit 0; sub start { POE::Component::Pcap->spawn( Alias => 'pcap', Device => $device, Filter => 'arp', Dispatch => 'got_packet', Session => $_[SESSION], ); $_[KERNEL]->post( pcap => 'run' ); print STDERR "\n## Waiting for one ARP packet on $device. . .\n"; } sub _signal { print STDERR "\n## Got signal ", $_[ARG0], "\n"; $_[KERNEL]->post( pcap => 'shutdown' ); return 1 } sub got_packet { my $packets = $_[ARG0]; process_packet( @{ $_ } ) foreach( @{$packets} ); print STDERR "\n## Saw an ARP packet.\n"; ok( 1 ); $_[KERNEL]->post( pcap => 'shutdown' ); } sub process_packet { my( $hdr, $pkt ) = @_; ## Map arp opcode #'s to strings my %arp_opcodes = ( ARP_OPCODE_REQUEST, 'ARP Request', ARP_OPCODE_REPLY, 'ARP Reply', RARP_OPCODE_REQUEST, 'RARP Request', RARP_OPCODE_REPLY, 'RARP Reply', ); my $eth = NetPacket::Ethernet->decode($pkt); my $arp = NetPacket::ARP->decode( $eth->{data} ); print STDERR join(":", (localtime($hdr->{tv_sec}))[2,1,0]), ".", $hdr->{tv_usec}, ": ", $arp_opcodes{ $arp->{opcode} }, " ", $hdr->{caplen}, " bytes (of ", $hdr->{len}, ")\n"; print STDERR "\tsha: ", _phys( $arp->{sha} ), "\tspa: ", _ipaddr( $arp->{spa} ), "\n\ttha: ", _phys( $arp->{tha} ), "\ttpa: ", _ipaddr( $arp->{tpa} ), "\n"; } ## Pretty printing subs sub _ipaddr { join( ".", unpack( "C4", pack( "N", oct( "0x". shift ) ) ) ) } sub _phys { join( ":", grep {length} split( /(..)/, shift ) ) } __END__ libpoe-component-pcap-perl-0.04/debian/0000755000175000017500000000000011221132040016770 5ustar cajuscajuslibpoe-component-pcap-perl-0.04/debian/watch0000644000175000017500000000030310747355275020052 0ustar cajuscajus# format version number, currently 3; this line is compulsory! version=3 http://search.cpan.org/dist/POE::Component::Pcap/ .*/POE::Component::Pcap-v?(\d[\d_.-]+)\.(?:tar(?:\.gz|\.bz2)?|tgz|zip)$ libpoe-component-pcap-perl-0.04/debian/rules0000755000175000017500000000323410747355275020107 0ustar cajuscajus#!/usr/bin/make -f # This debian/rules file is provided as a template for normal perl # packages. It was created by Marc Brockschmidt for # the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may # be used freely wherever it is useful. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # If set to a true value then MakeMaker's prompt function will # always return the default without waiting for user input. export PERL_MM_USE_DEFAULT=1 PACKAGE=$(shell dh_listpackages) ifndef PERL PERL = /usr/bin/perl endif TMP =$(CURDIR)/debian/$(PACKAGE) build: build-stamp build-stamp: dh_testdir # Add commands to compile the package here $(PERL) Makefile.PL INSTALLDIRS=vendor $(MAKE) touch $@ clean: dh_testdir dh_testroot dh_clean build-stamp install-stamp # Add commands to clean up after the build process here [ ! -f Makefile ] || $(MAKE) realclean install: install-stamp install-stamp: build-stamp dh_testdir dh_testroot dh_clean -k # Add commands to install the package into $(TMP) here $(MAKE) install DESTDIR=$(TMP) PREFIX=/usr [ ! -d $(TMP)/usr/lib/perl5 ] || rmdir --ignore-fail-on-non-empty --parents --verbose $(TMP)/usr/lib/perl5 touch $@ binary-arch: # We have nothing to do here for an architecture-independent package binary-indep: build install dh_testdir dh_testroot dh_installexamples dh_installdocs README dh_installchangelogs CHANGES dh_perl dh_compress dh_fixperms dh_installdeb dh_gencontrol dh_md5sums dh_builddeb source diff: @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary libpoe-component-pcap-perl-0.04/debian/compat0000644000175000017500000000000210747355275020223 0ustar cajuscajus5 libpoe-component-pcap-perl-0.04/debian/copyright0000644000175000017500000000154211046046610020741 0ustar cajuscajusThis is the debian package for the POE::Component::Pcap module. It was created by Cajus Pollmeier It was downloaded from http://search.cpan.org/dist/POE::Component::Pcap/ The upstream author is: Mike Fletcher, . Copyright 2000-2001, Mike Fletcher. All Rights Reserved. This is free software; you may redistribute it and/or modify it under the same terms as Perl itself. Perl is distributed under your choice of the GNU General Public License or the Artistic License. On Debian GNU/Linux systems, the complete text of the GNU General Public License can be found in `/usr/share/common-licenses/GPL' and the Artistic Licence in `/usr/share/common-licenses/Artistic'. The Debian packaging is (C) 2008, Cajus Pollmeier and is licensed under the same terms as the software itself (see above). libpoe-component-pcap-perl-0.04/debian/changelog0000644000175000017500000000025111221131752020651 0ustar cajuscajuslibpoe-component-pcap-perl (0.04-1) unstable; urgency=low * Initial upload (Closes: #532681) -- Cajus Pollmeier Tue, 24 Jun 2009 10:17:00 +0200 libpoe-component-pcap-perl-0.04/debian/control0000644000175000017500000000170511221132040020376 0ustar cajuscajusSource: libpoe-component-pcap-perl Section: perl Priority: optional Build-Depends: debhelper (>= 5.0.0), libpoe-perl Build-Depends-Indep: perl (>= 5.8.8) Maintainer: GOsa packages mainteners group Uploaders: Cajus Pollmeier , Benoit Mortier Standards-Version: 3.8.2 Homepage: http://search.cpan.org/dist/POE::Component::Pcap/ Vcs-Browser: https://oss.gonicus.de/repositories/goto/trunk/libpoe-component-pcap-perl Vcs-Svn: https://oss.gonicus.de/repositories/goto/trunk/libpoe-component-pcap-perl Package: libpoe-component-pcap-perl Architecture: all Depends: ${perl:Depends}, ${misc:Depends}, libnet-pcap-perl, libnetpacket-perl Description: POE Interface to Net::Pcap POE::Component::Pcap provides a wrapper for using the Net::Pcap module from POE programs. The component creates a separate session which posts events to a specified session and state when packets are available. . libpoe-component-pcap-perl-0.04/eg/0000755000175000017500000000000011221131714016150 5ustar cajuscajuslibpoe-component-pcap-perl-0.04/eg/awtest0000644000175000017500000000241010747355275017425 0ustar cajuscajus#!/usr/bin/perl use strict; #BEGIN { sub POE::Kernel::TRACE_DEFAULT { 0 } } use POE; use Pcap; use ArpWatch; my $device = shift || 'wi0'; POE::Session->create( inline_states => { _start => \&start, _stop => sub { $_[KERNEL]->post( arp_watch => 'shutdown' ) }, got_packet => \&got_packet, signal => \&signal, }, ); $poe_kernel->run; exit 0; sub start { POE::Component::ArpWatch->spawn( Alias => 'arp_watch', Device => $device, Dispatch => 'got_packet', Session => $_[SESSION], ); $_[KERNEL]->sig( $_ => 'signal' ) for qw( INT HUP TERM QUIT ); $_[KERNEL]->post( arp_watch => 'run' ); print "Waiting for packets . . .\n"; } sub signal { print "Got signal ", $_[ARG0], ", exiting\n"; $_[KERNEL]->post( arp_watch => 'shutdown' ); $_[KERNEL]->sig_handled(); } sub got_packet { my $packet = $_[ARG0]; print join( ':', (localtime( $packet->{tv_sec} ))[2,1,0]), '.', $packet->{tv_usec}, ': ', $packet->{type}, "\n"; print "\tsha: ", $packet->{source_haddr}, "\tspa: ", $packet->{source_ipaddr}, "\n", "\ttha: ", $packet->{target_haddr}, "\ttpa: ", $packet->{target_ipaddr}, "\n"; } libpoe-component-pcap-perl-0.04/eg/ArpWatch.pm0000644000175000017500000001003510747355275020244 0ustar cajuscajus#!/usr/bin/perl package POE::Component::ArpWatch; use strict; use POE; use Pcap; use NetPacket::Ethernet qw( :types ); use NetPacket::ARP qw( :opcodes ); ## Map arp opcode #'s to strings my %arp_opcodes = ( NetPacket::ARP::ARP_OPCODE_REQUEST, 'ARP Request', NetPacket::ARP::ARP_OPCODE_REPLY, 'ARP Reply', NetPacket::ARP::RARP_OPCODE_REQUEST, 'RARP Request', NetPacket::ARP::RARP_OPCODE_REPLY, 'RARP Reply', ); ## ## POE::Component::ArpWatch->spawn( ## [ Alias => 'arp_watch' ], ## [ Device => 'eth0' ], ## [ Dispatch => dispatch_state ], ## [ Session => dispatch_session ], ## ) ## sub spawn { my $class = shift; my %args = @_; $args{ Alias } ||= 'arp_watch'; POE::Session->create( inline_states => { _start => \&_start, # _signal => \&_signal, _stop => \&_stop,, _dispatch => \&_dispatch, set_dispatch => \&set_dispatch, run => \&run, pause => \&pause, shutdown => \&shutdown, }, args => [ $args{ Alias }, # ARG0 $args{ Device }, # ARG1 $args{ Dispatch },# ARG2 $args{ Session }, # ARG3 ], ); return $args{ Alias }; } sub _start { my ($kernel, $heap, $session, $alias, $device, $target_state, $target_session ) = @_[ KERNEL, HEAP, SESSION, ARG0..ARG3 ]; POE::Component::Pcap->spawn( Alias => $alias . '_pcap', Device => $device, Filter => 'arp', Dispatch => '_dispatch', Session => $session, ); $heap->{'pcap_session'} = $kernel->alias_resolve( $alias . '_pcap' ); ## Set alias for ourselves and remember it $kernel->alias_set( $alias ); $heap->{Alias} = $alias; ## Set dispatch target session and state if it was given if( defined( $target_session ) ) { $heap->{'target_session'} = $target_session; $heap->{'target_state'} = $target_state; } } sub set_dispatch { my( $heap, $sender, $target ) = @_[ HEAP, SENDER, ARG0 ]; if( defined $target ) { ## Remember whome to forward results to $heap->{'target_session'} = $sender; $heap->{'target_state'} = $target; } else { ## Clear target delete $heap->{'target_session'}; delete $heap->{'target_state'}; } } sub run { $_[KERNEL]->post( $_[HEAP]->{'pcap_session'} => 'run' ); } sub pause { $_[KERNEL]->post( $_[HEAP]->{'pcap_session'} => 'pause' ); } sub _dispatch { my( $kernel, $heap, $packets ) = @_[ KERNEL, HEAP, ARG0 ]; if( exists $heap->{'target_session'} ) { $kernel->post( $heap->{'target_session'}, $heap->{'target_state'}, _process_packet( @{ $_ } ) ) foreach( @{$packets} ); } } sub _signal { # print "Got signal ", $_[ARG0], "\n"; $_[KERNEL]->post( pcap => 'shutdown' ); return 1 } sub shutdown { my ( $kernel, $heap, $session, $sender ) = @_[ KERNEL, HEAP, SESSION, SENDER ]; my $alias = $heap->{Alias}; # print "In shutdown for sid ", $session->ID, ", alias $alias\n"; # print "shutdown by ", $sender->ID, "\n"; $kernel->post( $heap->{'pcap_session'} => 'shutdown' ); $kernel->alias_remove( $alias ); # print "Out shutdown for sid ", $session->ID, ", alias $alias\n"; } sub _stop { my ( $kernel, $heap, $session ) = @_[ KERNEL, HEAP, SESSION ]; my $alias = $heap->{Alias}; # print "In state_stop for sid ", $session->ID, ", alias $alias\n"; # print "Out state_stop for sid ", $session->ID, ", alias $alias\n"; } sub _process_packet { my( $hdr, $pkt ) = @_; my $arp = NetPacket::ARP->decode( NetPacket::Ethernet->decode($pkt)->{data} ); ## Return hashref with apropriate fields return { type => $arp_opcodes{ $arp->{opcode} }, tv_sec => $hdr->{tv_sec}, tv_usec => $hdr->{tv_usec}, source_haddr => _phys( $arp->{sha} ), source_ipaddr => _ipaddr( $arp->{spa} ), target_haddr => _phys( $arp->{tha} ), target_ipaddr => _ipaddr( $arp->{tpa} ), } } ## Pretty printing subs for addresses sub _ipaddr { join( ".", unpack( "C4", pack( "N", oct( "0x". shift ) ) ) ) } sub _phys { join( ":", grep {length} split( /(..)/, shift ) ) } 1; __END__ libpoe-component-pcap-perl-0.04/Makefile.PL0000644000175000017500000000120410747355275017552 0ustar cajuscajus#!/usr/bin/perl # $Id: Makefile.PL,v 1.3 2003/07/08 15:39:01 fletch Exp $ use ExtUtils::MakeMaker; WriteMakefile ( NAME => 'POE::Component::Pcap', AUTHOR => 'Mike Fletcher ', ABSTRACT => 'POE component for non-blocking use of Net::Pcap.', VERSION_FROM => 'Pcap.pm', PM => { 'Pcap.pm' => '$(INST_LIBDIR)/Pcap.pm' }, PREREQ_PM => { POE => 0.26, Net::Pcap => 0.04, NetPacket::Ethernet => 0.01, }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, ); libpoe-component-pcap-perl-0.04/Pcap.pm0000644000175000017500000002332210747355275017026 0ustar cajuscajus#!/usr/bin/perl ## ## $Id: Pcap.pm,v 1.3 2003/07/08 15:09:54 fletch Exp $ ## package POE::Component::Pcap; use strict; use Carp qw( croak carp ); $POE::Component::Pcap::VERSION = q{0.04}; use POE; use Symbol qw( gensym ); use IO::Handle; use Fcntl qw( F_GETFL F_SETFL O_NONBLOCK ); use Net::Pcap; ## ## POE::Component::Pcap->spawn( ## [ Alias => 'pcap' ], ## [ Device => 'eth0' ], ## [ Filter => 'pcap filter' ], ## [ Dispatch => dispatch_state ], ## [ Session => dispatch_session ], ## ) ## sub spawn { my $class = shift; my %args = @_; ## Set default alias if none was given $args{ Alias } ||= 'pcap'; POE::Session->create( inline_states => { _start => \&_start, _stop => \&_stop, # _signal => \&_signal, open_live => \&open_live, set_filter => \&set_filter, set_dispatch => \&set_dispatch, run => \&run, pause => \&pause, _dispatch => \&_dispatch, shutdown => \&shutdown, }, args => [ $args{Alias}, # ARG0 $args{Filter}, # ARG1 $args{Session}, # ARG2 $args{Dispatch},# ARG3 $args{Device}, # ARG4 ], ); return $args{ Alias }; } sub _start { my ($kernel, $heap, $session, $alias, $filter, $target_session, $target_state, $device ) = @_[ KERNEL, HEAP, SESSION, ARG0..ARG4 ]; # print "In state_start for sid ", $session->ID, ", alias $alias\n"; ## Set alias for ourselves and remember it $kernel->alias_set( $alias ); $heap->{Alias} = $alias; ## Set dispatch target session and state if it was given if( defined( $target_state ) ) { $heap->{'target_session'} = $target_session; $heap->{'target_state'} = $target_state; } ## Post an open_live event if device was passed $kernel->post( $session => open_live => $device ) if defined( $device ); ## Set filter if it was given $kernel->post( $session => set_filter => $filter ) if defined( $filter ); # print "Out state_start for sid ", $session->ID, ", alias $alias\n"; } ## ## $kernel->post( pcap => open_live => ## [device], [snaplen], [promisc?], [timeout] ) ## sub open_live { my ( $kernel, $heap, $device, $snaplen, $promisc, $timeout, ) = @_[ KERNEL, HEAP, ARG0..ARG3 ]; my $err; ## Lookup default device if undef was passed unless( $device ) { $device = Net::Pcap::lookupdev( \$err ) or croak "Can't lookupdev: $err\n"; } ## Set `reasonable' defaults for other values $snaplen = 80 unless defined( $snaplen ); $promisc = 1 unless defined( $promisc ); $timeout = 100 unless defined( $timeout ); $heap->{'pcap_t'} = Net::Pcap::open_live( $device, $snaplen, $promisc, $timeout, \$err ) or croak "Can't Net::Pcap::open_live $device: $err\n"; @{$heap}{ qw/device snaplen promisc timeout fd/ } = ( $device, $snaplen, $promisc, $timeout, Net::Pcap::fileno( $heap->{'pcap_t'} ), ); =pod ## Need an IO::Handle to $kernel->select_read() upon $heap->{fdh} = IO::Handle->new_from_fd( $heap->{fd}, "r" ) or die "Can't create IO::Handle from pcap fd: $!\n"; =cut $heap->{fdh} = gensym; open( $heap->{fdh}, "<&".$heap->{fd} ) or die "Can't dup handle from pcap fd: $!\n"; 1; } sub set_filter { my ( $kernel, $heap, $filter ) = @_[ KERNEL, HEAP, ARG0 ]; croak "open must be called before set_filter \n" unless exists $heap->{'pcap_t'}; my( $net, $netmask, $err ); Net::Pcap::lookupnet( $heap->{'device'}, \$net, \$netmask, \$err ); my $filter_t; Net::Pcap::compile( $heap->{'pcap_t'}, \$filter_t, $filter, 1, $netmask ) == 0 or die "Can't compile filter `$filter'\n"; Net::Pcap::setfilter( $heap->{'pcap_t'}, $filter_t ); } ## ## $kernel->post( pcap => set_dispatch => ## 'target_state', 'target_session' ) ## sub set_dispatch { my ( $heap, $sender, $target_state, $target_session ) = @_[ HEAP, SENDER, ARG0, ARG1 ]; ## Target session defaults to the sender $target_session ||= $sender; if( defined( $target_state ) ) { ## Remember whom to forward packets to $heap->{'target_session'} = $target_session; $heap->{'target_state'} = $target_state; } else { ## Clear target delete $heap->{'target_session'}; delete $heap->{'target_state'}; } } sub run { my ( $kernel, $heap ) = @_[ KERNEL, HEAP ]; my $flags; ## Can't run unless we've got a pcap_t to work with croak "open must be called before run \n" unless exists $heap->{'pcap_t'}; ## XXX Need to save off flags for OpenBSD if( $^O eq 'openbsd' ) { $flags = fcntl($heap->{fdh}, F_GETFL, 0) or croak "fcntl fails with F_GETFL: $!\n"; } $kernel->select_read( $heap->{fdh} => '_dispatch' ); ## XXX OpenBSD's pcap / bpf devices don't like being set to ## non-blocking for some reason, so restore the saved flags if( $^O eq 'openbsd' ) { $flags = fcntl($heap->{fdh}, F_SETFL, $flags ) or croak "fcntl fails with F_SETFL: $!\n"; } } sub _dispatch { my ( $kernel, $heap ) = @_[ KERNEL, HEAP ]; if( exists $heap->{'target_session'} ) { my @pending; ## Get Pcap to pass us any pending packets Net::Pcap::dispatch( $heap->{'pcap_t'}, -1, sub { push @{$_[0]}, [ @_[1,2] ] }, \@pending ); $kernel->post( $heap->{'target_session'}, $heap->{'target_state'}, \@pending, ); } } sub pause { ## Remove read select on pcap handle $_[KERNEL]->select_read( $_[HEAP]->{fdh} ) if exists $_[HEAP]->{fdh}; } sub shutdown { my ( $kernel, $heap ) = @_[ KERNEL, HEAP ]; ## Remove read select on pcap handle $kernel->select_read( $heap->{fdh} ) if exists $heap->{fdh}; ## Get Net::Pcap to shut down pcap_t if( exists $heap->{'pcap_t'} ) { Net::Pcap::close( $heap->{'pcap_t'} ); delete @{$heap}{qw/pcap_t fd fdh/} } $kernel->alias_remove( $heap->{Alias} ); } sub _stop { my ( $kernel, $heap, $session ) = @_[ KERNEL, HEAP, SESSION ]; my $alias = $heap->{Alias}; # print "In state_stop for sid ", $session->ID, ", alias $alias\n"; # print "Out state_stop for sid ", $session->ID, ", alias $alias\n"; } sub _signal { my ( $kernel, $heap, $session ) = @_[ KERNEL, HEAP, SESSION ]; # print "Got signal ", $_[ARG0], "\n"; return 1; } 1; __END__ =head1 NAME POE::Component::Pcap - POE Interface to Net::Pcap =head1 SYNOPSIS use POE::Component::Pcap; POE::Component::Pcap->spawn( Alias => 'pcap', Device => 'eth0', Filter => 'host fooble or host blort', Dispatch => 'got_packet', Session => $my_session_id, ); $poe_kernel->post( pcap => open_live => 'eth0', 80, 1, 100 ); $poe_kernel->post( pcap => set_filter => 'arp or host zooble' ); $poe_kernel->post( pcap => set_dispatch => 'target_state' ); $poe_kernel->post( pcap => 'run' ); $poe_kernel->post( pcap => 'shutdown' ); =head1 DESCRIPTION POE::Component::Pcap provides a wrapper for using the Net::Pcap module from POE programs. The component creates a separate session which posts events to a specified session and state when packets are available. =head2 ARGUMENTS =over 4 =item Alias The alias for the Pcap session. Used to post events such as C and C to control the component. Defaults to C if not specified. =item Device As a shortcut, the device for Net::Pcap to watch may be specified when creating the component. If this argument is used, Net::Pcap::open_live will be called with a snaplen of 80 octets, a timeout of 100ms, and the interface will be put in promiscuous mode. If these values are not suitable, post an C event instead. =item Filter Another shortcut, calls Net::Pcap::compile and Net::Pcap::setfilter to set a packet filter. This can only be used if the B argument is also given; otherwise a C event should be posted after an C event (since Net::Pcap must have a C descriptor to work with). =item Dispatch =item Session These specify the session and state to which events should be posted when packets are received. =back =head2 EVENTS The following examples assume that the component's alias has been set to the default value of B. =over 4 =item open_live $_[KERNEL]->post( pcap => open_live => 'device', [snaplen], [promsic?], [timeout] ); Calls Net::Pcap::open_live. The device name must be specified. The snaplen, promiscuous, and timeout parameters default to 80, 1, and 100 respectively. This event must be posted (or the B argument must have been passed to spawn()) before anything else can be done with the component. =item set_filter $_[KERNEL]->post( pcap => set_filter => 'host fooble or host blort' ) Sets the Net::Pcap capture filter. See tcpdump(8) for details on the filter language used by pcap(3). =item set_dispatch $_[KERNEL]->post( pcap => set_dispatch => 'target_state', 'target_session' ); Sets the state and session to which events are sent when packets are recevied. The target session will default to the sender of the event if not specified. The event posted will have a single argument (available as B) which will be an array reference containing the C<$hdr> and C<$pkt> parameters from Net::Pcap. See the Net::Pcap(3) documentation for more details. =item run $_[KERNEL]->post( pcap => 'run' ); Causes the component to register a select_read and start watching for packets. =item shutdown $_[KERNEL]->post( pcap => 'shutdown' ); Shuts the component down. Causes Net::Pcap::close to be called. =back =head1 SEE ALSO Net::Pcap(3), pcap(3), tcpdump(8), POE(3), POE::Component(3) =head1 AUTHOR Mike Fletcher, =head1 COPYRIGHT Copyright 2000-2001, Mike Fletcher. All Rights Reserved. This is free software; you may redistribute it and/or modify it under the same terms as Perl itself. =cut libpoe-component-pcap-perl-0.04/README0000644000175000017500000000310610747355275016463 0ustar cajuscajus$Id: README,v 1.2 2003/07/08 15:21:35 fletch Exp $ -------- Abstract -------- POE::Component::Pcap is a POE wrapper for the Net::Pcap wrapper for libpcap. It exists as a separate session which sends events back to a specified session when packets are ready. ------------ Requirements ------------ This module requires POE and Net::Pcap. The requirements are encoded in Makefile.PL. The NetPacket::* modules are also probably useful. ------------------ Basic Installation ------------------ POE::Component::Pcap may be installed through the CPAN shell in the usual CPAN shell manner. This typically is: $ perl -MCPAN -e 'intstall POE::Component::Pcap' You can also read this README from the CPAN shell: $ perl -MCPAN -e shell cpan> readme POE::Component::Pcap And you can install the component from the CPAN prompt as well: cpan> install POE::Component::Pcap ------------------- Manual Installation ------------------- POE::Component::Pcap can also be installed manually. The latest CPAN version can be found at or in a similarly named directory at your favorite CPAN mirror. The most recent development snapshot, which only rarely contains hideous show-stopping bugs, is available from . Downloading and unpacking the distribution are left as exercises for the reader. To build and test it: perl Makefile.PL make test When you're ready to install the component: make install It should now be ready to use. --------------------------- EOF: Thank you for reading. --------------------------- libpoe-component-pcap-perl-0.04/CHANGES0000644000175000017500000000270410747355275016601 0ustar cajuscajus$Id: CHANGES,v 1.3 2003/07/08 15:19:53 fletch Exp $ ============ Things to do ============ Fix / figure out why setting O_NONBLOCK confuzzles pcap on OpenBSD. ================================================ Revision history for POE::Component::Pcap ================================================ Changes marked with "(!!!)" may break backward compatibility. Changes marked with "(???)" are just information. Note to self: Don't forget to tag the version after a new distribution is released. For example: `cvs tag -Rc v1_00 .' --------------- 0.04 2003.07.08 --------------- Fixed bugs.cpan.org #1663 (a while back actually, just got around to packaging). Updated things to work with POE 0.26 (removed _signal). Tested (minimally :) on: FreeBSD i386 5.0, perl 5.6.1 Linux i386 RH9.0, perl 5.8.0 --------------- 0.03 2001.03.06 --------------- Michael Stevens noticed that NetPacket::Ethernet wasn't in the list of required packages. D'oh. --------------- 0.02 2001.02.16 --------------- First Public Release. Has an actual working test script. OpenBSD i386 2.8 Linux i386 RH6.2 Solaris Sparc 2.7 --------------- 0.01 2000.11.28 --------------- Initial version. Versioned at 0.01 because it's relatively untested. Has at least been run on (and seen packets :) the following: OpenBSD i386 2.7 Linux i386 RH6.2 Solaris Sparc 2.7 Additions to the list are welcome. =========================== EOF: Thank you for reading. ===========================