NAME
CTest - Perl extension for testing local 'C' routines
SYNOPSIS
use CTest;
DESCRIPTION
This module consists of various test routines to exercise the subroutines in the the 'C' pieces for dbtarpit
$pid = t_pidrun();
input: none output: pid found in pid file see t_chk4pid below
t_savpid(path2pidfile)
input: path to pid file output: none saves the pid of the current process in the pid file (path2pidfile)
$pidpath = t_chk4pid(path)
input: path to pid file output: undef or path to pid file checks for a process running with the pid found in "path". If the process is running return undef, otherwise return the "path". Always places the "pid" found in pid file into the variable "pidrun".
$pidpath = t_pidpath();
input: none output: current pidpath/file
$rv=t_main(qw(program_name args, arg2,..., argN);
input: program name -d -f etc... see readme output: number of arguments passed
t_setsig();
set the signal handler. test routine should issue SIGINT to child and catch resulting text
($size,$seed) = t_inirand(test);
input: 0 = seed with time n = seed with "n" output: size of random array random number seed value Initialize the random number generator
@random = t_fillrand();
input: none (use t_inirand above) output: random array of $size
$IPPROTO_TCP = t_ret_IPPTCP();
input: none output: numeric value of IPPROTO_TCP
$rv = t_chk_trace();
input: none output: conditional return value of "trace_tarpit" (below) conditionally called by check_4_tarpit(m) int tarpit(void * v) { extern int trace_tarpit; extern int dummy_tarpit; trace_tarpit = dummy_tarpit; return(trace_tarpit); }
t_Lflag(ell);
Set the value of Lflag;
input: integer output: none
t_NF_ACCEPT();
Return the value of NF_ACCEPT.
t_NF_DROP();
Return the value of NF_DROP.
$rv = t_check(addr,ts,xf,prot,tarpitresp);
input: ip address (dot quad) timestamp xflag protocol tarpit response output: rv of check_4_tarpit(m)
$err = t_init(home,...);
input: dbhome db file name secondary db file name (optional) output: 0 or error code
$err = t_dump(which);
input: 0 = primary db nz = secondary db output: 0 or error code prints database to STDOUT in the format dot.quad.addr => timestamp
t_close();
input: none output: none close the database files and environment
$rv = t_findaddr(addr,timestamp);
input: packed network address timestamp output: true if address found in primary database updates timestamp in database if addr found
t_saveaddr(addr, timestamp);
input: packed network address timestamp output: none inserts address (if absent) in secondary database, updates timestamp
t_statn(name);
input: database name output: number of keys or zero on error
($errno,$fd)=t_LogPrint(dbhome,fifoname,message,oflag,Oflag,[fd])
Directly call the LogPrint routine.
input: pointer to home path, pointer to fifo name, pointer to message, oflag, Oflag, fd value [optional] (defaults to 0) output: error number, file descriptor in scalar context returns errno only prints somewhere dependent on fifoname oflag Oflag don't print to a closed syslog!
t_fifo_close();
Close the fifo fd opened by LogPrint if it exists;
@errors = t_errors();
Returns an array of error numbers used for test.
EPIPE,ENOSPC,EEXIST,ENOENT,ENOTDIR,ENXIO,ENODEV
t_get(ai,addr,notstring)
Same functionality as Tools::t_get but uses readOne
t_getrecno(ai,cursor,notstring)
Same functionality as Tools::t_getrecno but uses readOne
t_libversion(ai)
Similar functionality to Tools::t_libversion() and Tools::t_nkeys;
input: index to database returns: number of keys, major version, minor version, patch
In scalar context returns only number of keys
EXPORT
None
AUTHOR
Michael Robinton <michael@bizsystems.com>