NAME

IPTables::Log::Set::Record - Holds a single IPTables/Netfilter log entry.

SYNOPSIS

Note that this class isn't designed to be created directly. You can create these objects via a IPTables::Log::Set object.

  use IPTables::Log;
  my $l = IPTables::Log->new;
  my $s = $l->create_set;
  my $r = $s->create_record({text => '...IN=eth0 OUT=eth1 MAC=00:...'});
  $r->parse;

DEPENDENCIES

  • Class::Accessor - for accessor methods

  • Data::GUID - for GUID generation

  • NetAddr::IP - for the src and dst methods

CONSTRUCTORS

Record->create({text = '...IN=eth0 OUT=eth1 MAC=00:...'}>)

Creates a new IPTables::Log::Set::Record object. You shouldn't call this directly - see the synopsis for an example.

METHODS

$record->parse

Parses the log message text passed either to the constructor, or via set_text.

$record->set_text("...IN=eth0 OUT=eth1 MAC=00:...")

Sets the log message text. Either this must be set, or the text must have been passed to create, otherwise parse will error.

ACCESSOR METHODS

get(field)

Returns the value of field. Field can be one of guid, date, time, hostname, prefix, in, out, mac, src, dst, proto, spt, dpt, id, len, ttl, df, window, syn.

get_guid

Returns the GUID for the packet.

get_date

Returns the date portion of the log message.

get_time

Returns the time portion of the log message.

get_hostname

rETURns the hostname portion of the log message.

get_prefix

Returns the iptables/netfilter log prefix for the log message, i.e. the part specified by -j LOG --log-prefix='LOG PREFIX '.

get_in

Returns the ingress interface, if specified.

get_out

Returns the egress interface, if specified.

get_mac

Returns the MAC address, if specified.

get_src

Returns the source IP address.

get_dst

Returns the destination IP address.

get_proto

Returns the protocol.

get_spt - TCP and UDP packets only.

Returns the source port, if applicable.

get_dpt - TCP and UDP packets only.

Returns the destination port, if applicable

get_id

Returns the packet ID.

get_len

Returns the packet length.

get_ttl

Returns the packet's TTL (Time To Live).

get_df

Returns the packet's DF (Don't Fragment) value.

get_window - TCP and UDP packets only.

Returns the packet's window size.

get_sync

Returns 1 if the packet is a SYN, otherwise returns 0.

get_parsed

Returns 1 if the packet has been successfully parsed, otherwise returns 0.

CAVEATS

It parses log entries. It doesn't do much else, yet.

BUGS

None that I'm aware of ;-)

AUTHOR

This module was written by Andy Smith <andy.smith@netprojects.org.uk>.

COPYRIGHT

$Id: Record.pm 21 2010-12-17 21:07:37Z andys $

(c)2009 Andy Smith (http://andys.org.uk/)

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.