Zachary D. Blair > Net-Tshark > Net::Tshark::Field

Download:
Net-Tshark-0.04.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.04   Source  

NAME ^

Net::Tshark::Field - Represents a field in a packet returned by Net::Tshark.

SYNOPSIS ^

  use Net::Tshark;

  # Start the capture process, looking for HTTP packets
  my $tshark = Net::Tshark->new;
  $tshark->start(interface => 2, display_filter => 'http');

  # Do some stuff that would trigger HTTP packets for 30 s
  ...

  # Get any packets captured
  my @packets = $tshark->get_packets;
  
  # Extract packet information by accessing each packet like a nested hash
  foreach my $packet (@packets) {
    if ($packet->{http}->{request})
    {
      my $host = $packet->{http}->{host};
      my $method = $packet->{http}->{'http.request.method'};
      print "\t - HTTP $method request to $host\n";
    }
    else
    {
      my $code = $packet->{http}->{'http.response.code'};
      print "\t - HTTP response: $code\n";
    }
  }

DESCRIPTION ^

Represents a field within a packet returned by Net::Tshark->get_packet.

METHODS

$packet->fields

Returns an array of the child fields of this field.

$packet->show
$packet->showname
$packet->name
$packet->size
$packet->value
$packet->hash

Returns a hash containing the contents of this field.

SEE ALSO ^

Net::Tshark - Interface for the tshark network capture utility

The PDML Specification - http://www.nbee.org/doku.php?id=netpdl:pdml_specification

AUTHOR ^

Zachary Blair, <zblair@cpan.org>

COPYRIGHT AND LICENSE ^

Copyright (C) 2012 by Zachary Blair

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.8 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: