GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Net::DNSBL::Utilities(3) User Contributed Perl Documentation Net::DNSBL::Utilities(3)

Net::DNSBL::Utilities - functions for DNSBL daemons

  use Net::DNSBL::Utilities qw(
        s_response 
        not_found  
        write_stats
        bystat
        statinit
        cntinit
        list2hash
        open_udpNB
        DO
        doINCLUDE
        list2NetAddr
        matchNetAddr
        list_countries
        setAUTH
        setRA
        A1271
        A1272
        A1273
        A1274
        A1275
        A1276
        A1277
  );

  s_response($mp,$resp,$id,$qdcount,$ancount,$nscount,$arcount);
  not_found($put,$name,$type,$id,$mp,$srp);
  write_stats($sfile,$cp,$sinit,$csize,$cache);
  $rv = bystat($cp);
  $timestamp = statinit($Sfile,$cp);
  cntinit($DNSBL,$cp);
  list2hash(\@list,$cp,$val);
  $sock = open_udpNB();
  $rv = DO($file,$nowarnings)
  $rv = doINCLUDE($file,$nowarnings);
  $rv=list2NetAddr(\@inlist,\@NAobject);
  $rv = matchNetAddr($ip,\@NAobject);
  ($countries,$code3s,$names) = list_countries;
  setAUTH(true/false);
  setRA(true/false);
  $netaddr = A1271;
  $netaddr = A1272;
  $netaddr = A1273;
  $netaddr = A1274;
  $netaddr = A1275;
  $netaddr = A1276;
  $netaddr = A1277;

Net::DNSBL::Utilities contains functions used to build DNSBL emulator daemons.
  • s_response($mp,$resp,$id,$qdcount,$ancount,$nscount,$arcount);

    Put a short response into the message buffer pointed to by $mp by sticking a new header on the EXISTING received query.

      input:        msg pointer,
                    id of question,
                    qd, an, ns, ar counts
      returns:      nada
        
  • not_found($put,$name,$type,$id,$mp,$srp);

    Put a new 'not found' response in the buffer pointed to by $mp.

      input:        put,
                    name,
                    type,
                    id,
                    message buffer pointer,
                    SOA record pointer
      returns:      nothing
        
  • write_stats($sfile,$cp,$sinit,$csize,$cache);

    Write out the contents of the accumulated statistics buffer to the STATs file.

      input:        statistics file path,
                    pointer to count hash,
                    initial timestamp line text
                    cache flag/max size
                    current cache size
      returns:      nothing
        
  • $rv = bystat($cp);

    Return sort value +-1 or 0 for stat sort

      input:        $a,$b sort values
                    pointer to count hash
      returns:      sort decision value
        
  • $timestamp = statinit($Sfile,$cp);

    Initialize the contents of the statistics hash with the file contents of $Sfile, if $Sfile exists and there are corresponding entries in the statistics hash. i.e. the statistics hash keys must first be initialized with the DNSBL (or LABEL) names.

      input:        statistics file path,
                    pointer to count hash
      returns:      timestamp line for file
                    or undef on failure
        
  • cntinit($DNSBL,$cp);

    Initialize the statistics count hash with DNSBL keys and set the counts to zero.

    For compatibility with other applications, LABEL names other than the DNSBL's must NOT contain '.' Only the keys in the DNSBL hash that contain '.'s are added to the count hash.

    The count hash is first emptied if it is not null to begin with.

      input:        pointer to DNSBL hash,
                    pointer to counts hash
      returns:      nothing
        
  • list2hash(\@list,$cp,$val);

    Add a list of names as keys to the statistics count hash and set the hash value to $val or zero if $val is not present.

    For compatibility with other applications, the labels in "list" must not contain the character '.'

      input:        pointer to list of labels,
                    pointer to counts hash,
                    value [optional]
      returns:      nothing
        
  • $rv = DO($file,$nowarnings);

    This is a fancy 'do file'. It first checks that the file exists and is readable, then does a 'do file' to pull the variables and subroutines into the current name space.

    See the documentation File::SafeDO

      input:        file/path/name
      returns:      last value in file
                or  undef on error
                prints warning
        
  • $rv = DO($file,$nowarnings);

    This is a fancy 'do file'. It first checks that the file exists and is readable, then does a 'do file' to pull the variables and subroutines into the current name space.

    See the documentation File::SafeDO

      input:        file/path/name
      returns:      last value in file
                or  undef on error
                prints warning
        
  • $sock = open_udpNB();

    Open and return a non-blocking UDP socket object

      input:        none
      returns:      pointer to socket object
                    or undef on failure
        
  • $rv=list2NetAddr(\@inlist,\@NAobject);

    Build of NetAddr object structure from a list of IPv4 addresses or address ranges. This object is passed to matchNetAddr to check if a given IP address is contained in the list.

      input:        array reference pointer
                    to a list of addresses
    
      i.e.          11.22.33.44
                    11.22.33.0/24
                    11.22.33.0/255.255.255.0
                    11.22.33.20-11.22.33.46
                    11.22.33.20 - 11.22.33.46
    
      output:       Number of objects created
                    or undef on error
        

    The NAobject array is filled with NetAddr::IP::Lite object references.

  • $rv = matchNetAddr($ip,\@NAobject);

    Check if an IP address appears in a list of NetAddr objects.

      input:        dot quad IP address,
                    reference to NetAddr objects
      output:       true if match else false
        
  • ($countries,$code3s,$names) = list_countries;

    The function returns the list of 2 character, 3 character and country code names from the Geo::IP::PurePerl module if it is installed.

      input:        none
      returns:      \@countries,\@code3s,\@names
                    blessed into callers namespace
        

    NOTE: this process is very inefficient and should not be called in a repetitive fashion.

    If Geo::IP::PurePerl is not installed, the function returns and empty array and sets $@;

  • setAUTH(true/false);

    Set the Authoratitive Answer bit true or false for all replys

      input:        true/false
      returns:      nothing
        
  • setRA(true/false);

    Set the Recursion Allowed bit true or false for all replys

      input:        true/false
      returns:      nothing
        
  • $netaddr = A127x

    Functions A1271, A1272, A1273, etc..., return the packed network address for 127.0.0.1, 127.0.0.2, etc.... respectively

        Net::DNS::Codes
        Net::DNS::ToolKit

        s_response 
        not_found  
        write_stats
        bystat
        statinit
        cntinit
        list2hash
        open_udpNB
        DO
        list2NetAddr
        matchNetAddr
        list_countries
        setAUTH
        setRA
        A1271
        A1272
        A1273
        A1274
        A1275
        A1276
        A1277

Michael Robinton, michael@bizsystems.com

Copyright 2003 - 2007, Michael Robinton & BizSystems 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.

Net::DNS::Codes, Net::DNS::ToolKit, Mail::SpamCannibal
2022-04-08 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.