D/N/A project
A new way of using
Domain Name Service

Documents :: API

RNA::Internals


NAME

RNA::Internals


DESCRIPTION

This module is part of the RNA Server Project. RNA is an acronym for Domain Name Anarchy. For further informations take a look at RNA man page.

This module implements all the support functions for handling database queries doing raw operations and so on...


API

zoneMD5()

Compute MD5 hash of a zone name

parse_config_file( $filename [, $filename] )

Read a config file and return a hash describing the contents.

write_config_file( $filename, \%data, \@includes )

Writes configuration file $filename (which must be absolute path) filling in with data passed in %data hash structure. Data is conformed as:

  %data = (
    hostname => {
      value => 'localhost',
      comment => qq|#\n# This is the hostname of the box running RNA\n#\n|,
    },
    forwarders => {
      value => [ '127.0.0.1', '192.168.1.1' ],
      comment => qq|#\n# This is the list of external forwarders used in place of\n# internal recursive mechanism\n#\n|,
    }
    root_servers => {
        value => {
        A.ROOT-SERVERS.NET => '198.41.0.4',
        B.ROOT-SERVERS.NET => '128.9.0.107',
        },
        comment => qq|#\n# Root servers IP (similar to hint file of BIND)\n#\n|,
    },
    fork_server => {
      boolean => 1,
      value => 1,
      comment => qq|#\n# Should rna_named fork while managing requests?\n#\n|,
    },
  );

If value is an array reference, directive is prefixed with the '@' symbol; as opposed, if it's an hash reference, directive is prefixed with the '%' symbol. Otherwise, plain name is used. The boolean flag says that a scalar entry should be rendered as a ON/OFF switch. So, previous code produces this config output:

  -----------------------------------------------------------------------------------
  #
  # FILE: <filename>
  #
  # WARNING: This file has been automatically generated. Modify only if you are
  # sure about what you are doing.
  #
  #
  # This is the hostname of the box running RNA
  #
  hostname = 'localhost'
  #
  # This is the list of external forwarders used in place of
  # internal recursive mechanism
  #
  @forwarders = 127.0.0.1, 192.168.1.1
  #
  # Root servers IP (similar to hint file of BIND)
  #
  %root_servers = A.ROOT-SERVERS.NET => 198.41.0.4, B.ROOT-SERVERS.NET => 128.9.0.107
        #
        # Should rna_named fork while managing requests?
        #
        fork_server = ON
  ----------------------------------------------------------------------------------->

If value is null or undefined, the directive will be written as:

        #@forwarders = NOT_DEFINED

but eventual comment is include on top anyway.

Optionally it's also possible to include some other configuration files passing it as third argument as a list reference: @includes.

debug($line, $opt_level)

Accept one line of debug text and handle it correspondig to debug level. Suggested line format is:

 "C" "TEXT"

where ``C'' is a single char and ``TEXT'' is the content of debug line. $opt_level is an optional integer level of debugging.

debug_level($num)

Get or optionally set the debug level

dump_packet_to_file($packet, $query_id)

Dump the contents of $packet to file named /tmp/rna_named/packet.$query_id.

print_struct($structure, $level)

Prints a full data structure, made of scalars and references to arrays or hashes. $structure is the reference structure, while $level is the starting level which defaults to 0.

unique(@list)

Expunge from @list all duplicated elements. Return expunged list.

spawn( %actions )

Forks a subprocess and execute specified blocks of code. %actions is a hash with three keys: child, parent and failed, which should hold anonymous subroutines. Only child code is required. parent and failed are automatically substituted with a:

        sub { return 1 }

if missing.


AUTHOR

Tx0


SEE ALSO

RNA, RNA::SQL, RNA::Interface, rnad(8), rna_named(8)

This page last modified: Wednesday, 09-Jan-2008 16:25:01 CET
© 2007-2008 Tx0 - Some right reserved
This work is released under Creative Commons License
hosted by gna!
Valid HTML 4.01 Transitional
Valid CSS!