Michael Robinton > IPTables-IPv4-DBTarpit-0.44 > IPTables::IPv4::DBTarpit::Tools

Download:
IPTables-IPv4-DBTarpit-0.44.tar.gz

Dependencies

Annotate this POD

CPAN RT

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

NAME ^

  IPTables::IPv4::DBTarpit::Tools - to manipulate tarpit database

SYNOPSIS ^

  use IPTables::IPv4::DBTarpit::Tools qw(
        $DBTP_ERROR
        inet_aton
        inet_ntoa
        bdbversion
        libversion
        db_strerror
);

  $tool = new IPTables::IPv4::DBTarpit::Tools (
        # defaults shown - one or more db's
        dbfile  =>      ['tarpit','... etc'],
        dbhome  =>      '/var/run/dbtarpit',
        umask   =>      007,
  # optional
        txtfile =>      ['name1','... etc'],
        recover =>      1,
  );

  $string = db_strerror($DBTP_ERROR);
  $tool = new IPTables::IPv4::DBTarpit::Tools(%hash);
  $tool->closedb;
  $rv = $tool->get($db,$4byteIPaddress);
  ($key,$data) = $tool->getrecno($db,$recno);
  $rv = $tool->remove($db,$4byteIPaddress);
  $rv = $tool->put($db,$4byteIPaddress,$value);
  $rv = $tool->touch($db,$4byteIPaddress,$timestamp);
  $rv = $tool->sync($db);
  $rv = $tool->clear($db);
  $rv = $tool->cull($db,$age,\%hash,$nop); 
  $rv = $tool->dump($db,\%hash);
  $number = $tool->nkeys($db)
  ($string,$major,$minor,$patch)=bdbversion();
  ($string,$major,$minor,$patch)=libversion()  
  $netaddr = inet_aton($dotquad);
  $dotquad = inet_ntoa($netaddr);

DESCRIPTION ^

IPTables::IPv4::DBTarpit::Tools provides utilities to manage the database for IPtables QUEUE packets delivered to user space routine dbtarpit. Utilities are available to add/update the DB file as well as get, remove, and expire the host ip's in the databases.

DATABASE CONFIGURATION FILE [optional] ^

Usually used to increase database cache size.

Most of the configuration information that can be specified to DB_ENV methods can also be specified using a configuration file. Any file named DB_CONFIG in the database home directory will be read for lines of the format NAME VALUE.

One or more whitespace characters are used to delimit the two parts of the line, and trailing whitespace characters are discarded. All empty lines or lines whose first character is a whitespace or hash (#) character will be ignored. Each line must specify both the NAME and the VALUE of the pair. The specific NAME VALUE pairs are documented in the Berkeley DB manual for the corresponding methods.

See: http://www.sleepycat.com/docs/ref/env/db_config.html

DEPENDENCIES ^

        none

EXPORT ^

        DB_NOTFOUND
        DB_RUNRECOVERY

EXPORT_OK ^

        $DBTP_ERROR 
        inet_aton
        inet_ntoa
        bdbversion
        libversion
        db_strerror

ACKNOWLEDGEMENTS ^

inet_aton and inet_ntoa have been included with a few modifications from perl-5.80 by Larry Wall, copyright 1989-2002. Thank you Larry for making PERL possible for all of us.

Much of how to write this module and the bdb functions in the SpamCannibal package I learned from reading the source code of Paul Marquess's BerkeleyDB-0.20. The versioning information for Berkeley DB was all taken directly from Paul's module. Thanks Paul.

COPYRIGHT ^

Copyright 2003 - 2008, Michael Robinton <michael@bizsystems.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

AUTHOR ^

Michael Robinton <michael@bizsystems.com>

SEE ALSO ^

perl(1), Socket(3)

syntax highlighting: