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 dnsbls

  • $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
  • t_set_parent(val);

    set the value of "parent"
    return the previous value
  • t_set_qflag(val);

    set the value of "qflag"
    return the previous value
  • $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
  • $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
  • $data = t_get(which,addr);

      input:	0  = primary db
    		nz = secondary db
      output:	data (long)
    		or undef if not there
  • $short_hostname = t_short();

    input:	none
    output:	short host name
  • $rv = t_munge(fd,bp,msglen,is_tcp)

      input:	handle number, [fileno(FD)]
    		pointer buffer,
    		length of buffer,
    		tcp flag
    
      output:	number of bytes processed,
    		-1 on error
    
      NOTES: is_tcp
      Setting is_tcp true forces TCP mode in the ns.c
      is_tcp tells ns.c how to process the requests 
      (TCP or UDP) and specifically how to process AXFR 
      requests so we can test all of the program branches.
     
      is_tcp  = 0  use UDP
      is_tcp  = 1  use TCP, AXFR in one message if possible
      is_tcp  = 2  use TCP, AXFR in two messages. The first 
                   message contains all overhead records, SOA, 
                   NS, MX and local host stuff. The second 
                   message contains all numeric A & TXT records  
                   or as many as will fit.
      is_tcp >= 3  The first record is the same as is_tcp 2. 
                   Each additional record contains an A + TXT 
                   record pair for a particular numeric record, 
                   with the last record containing only the SOA
  • $rv = t_cmdline(cmd,stuff);

      input:	one of z,n,m,a,b,c,e,L,I,Z,
    		parameter
      output:	true on success else false
    
      SEE:		command line parameters for
    		rblns -z -n -m -a -b -c -e -Z

    L sets the name of the local host. If the zone name has been set already then the zoneEQlocal flag is set appropriately. If local host name is already set when the zone name is set, zoneEQlocal will again be set appropriately.

    I sets the IP address of the local host

  • $rv = t_set_resp(zero,stdResp);

      input:	ipaddr for zero,
    		ipaddr for stdResp
      output:	true on success,
    		else undef
    
      Set the ip address for db access
  • $rv = t_cmp_serial(s1,s2);

      input:	zone serial number pair
      returns:	 0	s1 = s2
    		-1	s1 < s2
    		 1	s1 > s2
    		>1	 undefined
  • $rv = t_name_skip(buf);

      input:	buffer of characters/numbers
      returns:	integer offset from begining
    		of buffer past dn names

EXPORT

None

AUTHOR

Michael Robinton <michael@bizsystems.com>

See also: files in subdirectory ./t