.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Net::Frame::Dump::Online2 3pm" .TH Net::Frame::Dump::Online2 3pm "2022-11-19" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Net::Frame::Dump::Online2 \- tcpdump like implementation, online mode and non\-blocking .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Net::Frame::Dump::Online2; \& \& # \& # Simply create a Dump object \& # \& my $oDump = Net::Frame::Dump::Online2\->new( \& dev => \*(Aqeth0\*(Aq, \& ); \& \& $oDump\->start; \& \& # Gather frames \& while (1) { \& if (my $f = $oDump\->next) { \& my $raw = $f\->{raw}; \& my $firstLayerType = $f\->{firstLayer}; \& my $timestamp = $f\->{timestamp}; \& } \& } \& \& $oDump\->stop; \& \& # \& # Default parameters on creation \& # \& my $oDumpDefault = Net::Frame::Dump::Online2\->new( \& timeoutOnNext => 3, \& timeout => 0, \& promisc => 0, \& snaplen => 1514, \& file => \*(Aq\*(Aq, \& overwrite => 0, \& ); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module implements a tcpdump-like program, for live capture from networks. .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" .IP "\fBdev\fR" 4 .IX Item "dev" The network interface to listen on. No default value. .IP "\fBtimeoutOnNext\fR" 4 .IX Item "timeoutOnNext" Each time you call \fBnext\fR method, an internal counter is updated. This counter tells you if you have not received any data since \fBtimeoutOnNext\fR seconds. When a timeout occurred, \fBtimeout\fR is set to true. .IP "\fBtimeout\fR" 4 .IX Item "timeout" When \fBtimeoutOnNext\fR seconds has been reached, this variable is set to true, and never reset. See \fBtimeoutReset\fR if you want to reset it. .IP "\fBsnaplen\fR" 4 .IX Item "snaplen" If you want to capture a different snaplen, set it a number. Default to 1514. .IP "\fBpromisc\fR" 4 .IX Item "promisc" By default, interface is not put into promiscuous mode, set this parameter to true if you want it. .PP The following are inherited attributes: .IP "\fBfilter\fR" 4 .IX Item "filter" Pcap filter to use. Default to no filter. .IP "\fBfirstLayer\fR" 4 .IX Item "firstLayer" Stores information about the first layer type contained on read frame. This attribute is filled only after a call to \fBstart\fR method. .IP "\fBisRunning\fR" 4 .IX Item "isRunning" Returns true if a call to \fBstart\fR has been done, false otherwise or if a call to \fBstop\fR has been done. .IP "\fBkeepTimestamp\fR" 4 .IX Item "keepTimestamp" Sometimes, when frames are captured and saved to a .pcap file, timestamps sucks. That is, you send a frame, and receive the reply, but your request appear to have been sent after the reply. So, to correct that, you can use \fBNet::Frame::Dump\fR own timestamping system. The default is 0. Set it manually to 1 if you need original .pcap frames timestamps. .SH "METHODS" .IX Header "METHODS" .IP "\fBnew\fR" 4 .IX Item "new" .PD 0 .IP "\fBnew\fR (hash)" 4 .IX Item "new (hash)" .PD Object constructor. You can pass attributes that will overwrite default ones. See \fB\s-1SYNOPSIS\s0\fR for default values. .IP "\fBstart\fR" 4 .IX Item "start" When you want to start reading frames from network, call this method. .IP "\fBstop\fR" 4 .IX Item "stop" When you want to stop reading frames from network, call this method. .IP "\fBnext\fR" 4 .IX Item "next" Returns the next captured frame; undef if none awaiting. Each time this method is called, a comparison is done to see if no frame has been captured during \fBtimeoutOnNext\fR number of seconds. If so, \fBtimeout\fR attribute is set to 1 to reflect the pending timeout. .IP "\fBstore\fR (\fBNet::Frame::Simple\fR object)" 4 .IX Item "store (Net::Frame::Simple object)" This method will store internally, sorted, the \fBNet::Frame::Simple\fR object passed as a single parameter. \fBgetKey\fR methods, implemented in various \fBNet::Frame::Layer\fR objects will be used to efficiently retrieve (via \fBgetKeyReverse\fR method) frames. .Sp Basically, it is used to make \fBrecv\fR method (from \fBNet::Frame::Simple\fR) to retrieve quickly the reply frame for a request frame. .IP "\fBgetFramesFor\fR (\fBNet::Frame::Simple\fR object)" 4 .IX Item "getFramesFor (Net::Frame::Simple object)" This will return an array of possible reply frames for the specified \fBNet::Frame::Simple\fR object. For example, reply frames for a \s-1UDP\s0 probe will be all the frames which have the same source port and destination port as the request. .IP "\fBflush\fR" 4 .IX Item "flush" Will flush stored frames, the one which have been stored via \fBstore\fR method. .IP "\fBtimeoutReset\fR" 4 .IX Item "timeoutReset" Reset the internal timeout state (\fBtimeout\fR attribute). .IP "\fBgetStats\fR" 4 .IX Item "getStats" Tries to get packet statistics on an open descriptor. It returns a reference to a hash that has to following fields: \fBps_recv\fR, \fBps_drop\fR, \fBps_ifdrop\fR. .SH "SEE ALSO" .IX Header "SEE ALSO" Net::Frame::Dump .SH "AUTHOR" .IX Header "AUTHOR" Patrice Auffret .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (c) 2006\-2020, Patrice Auffret .PP You may distribute this module under the terms of the Artistic license. See \s-1LICENSE\s0.Artistic file in the source distribution archive.