NAME
Net::Analysis::TCPMonologue - simple class to contain a TCP monologue
SYNOPSIS
use Net::Analysis::Packet;
use Net::Analysis::Monologue;
my $mono = Net::Analysis::Monologue->new();
$mono->add_packet($pkt);
print "Monologue was " .$mono->length().
"b long, over " .$mono->t_elapsed ()." seconds\n";
DESCRIPTION
A TCP monologue is a series of packets that travel in one direction, e.g. a HTTP response. A monologue ends when a data packet travels in the other direction. Pairs of monologues will often be linked as transactions.
As packets are added, this object updates some info. It assumes that the packet you've added belongs in the monologue, and that you're adding them in the correct order.
The payload of the monologue lives in $mono-
{data}>.
METHODS
new ( )
Takes no arguments.
add_packet ($pkt)
Adds any data, increments the packet counter, and keeps note of the time.
t_start ()
Returns an object representing the time the monologue started. Can be treated like a float, giving fractional epoch seconds. Only accurate to the microsecond.
t_end ()
Same as t_start()
, but giving the time the monologue ended (or the last packet so far, if you call it before the monologue has ended.)
t_elapsed ()
Returns an object representing t_end - t_start
for this monologue. Can be treated like a float, giving duration in fractional seconds.
n_packets ()
How many data packets were in the monologue.
length ()
How long the monologue data was, in bytes. Excludes all the various packet headers.
EXPORT
None by default.
AUTHOR
Adam B. Worrall, <worrall@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2004 by Adam B. Worrall
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.