This document is a quick index to the definitions in the DENTS source 
that are intended to be used by module writers. By the time you read
this, it probably needs to be updated, so please send email to the 
DENTS mailing list if there seems to be something interesting.

-EZA
24 June 1999

==============================================================================

Interesting MACRO definitions:

 DPRINTF() 
    A macro for printing debugging statements that will be compiled
    out of the server when it is built in production mode (without -DDEBUG)

 DT_XXX - The TYPE definitions for Resource Records
 DC_XXX - The CLASS definitions for Resource Records
 DE_XXX - The error codes used for return values



------------------------------------------------------------------------------

The following functions will be of interest to module writers.  The functions 
are documented inside the source module indicated.  Maybe once DENTS matures,
we will copy the documentation out of the code and into a separate document.


GLIB:

 Note that the server is linked vs. glib, so all of those data
 structures are available to the module writer.  Documentation for
 GLIB may be found at http://www.gtk.org/


From err.c  - Routines to generate error messages to the system

 These routines print messasges to stderr when the server is compiled in
 debug mode, and to syslog when the server is compiled in production mode.

 err_fatal ()  Print a message to syslog and cause the server to exit.
 err_warn ()   Print a warning message to syslog
 err_info ()   Print an informational message to syslog


From link.c - A linked list implementation

 A linked list implementation that is thread safe.  See function
 descriptions in link.h and an example in link.c.
 
 
From dns_build.c - An API that holds RR's passed from modules to the server

 dns_build_add ()  

    Add an RR to a dnsbuildrec * buffer passed into the module.

 dns_build_addr ()
   
    Add an RR already in the form of a dnsdbrrrec * to a dnsbulidrec * 
    buffer  passed into the module.

 dns_build_alloc_data ()
 
    allocate a buffer that can be used to place RDATA in for passing
    to dns_build_add (). This data is automatically freed by
    dns_build_delete() when the server is finished with the 
    dnsbuildrec * buffer (after it sends the DNS packet.)
  
 dns_build_findans_and_pack ()
 dns_build_findaddit_and_pack ()
 dns_build_findauth_and_pack ()
   
    Searches an RB tree of dbnoderec types to fill in a dnsbuildrec *
    buffer. 


From dns_types.c - API to mangle RRs into DENTS internal format

 dns_types_findclass () 
 
    Translates an ASCII class string (such as "IN", "CH", "HS", and "CS") into 
    the Dents DC_XXX value 

 dns_types_findrrtype_by_label ()
   
    Given an ASCII type string (such as "A", "CNAME, or "PTR) returns a 
    dnsrrtyperec * value, which contains, among other things, the 
    Dents DT_XXX value.

 dns_types_findrrtype_by_type ()
   
    Given a Dents DT_XXX value, returns a dnsrrtyperec * value,
    which contains, among other things, the ASCII type string.

 dns_types_pack() 

    Creates an 'RDATA' buffer for a resource record for different RR Types
    Takes a list of strings and packs them into a buffer sutable for passing 
    to dns_build_add() as the 'data' arg.  Used by STDDB to turn the
    master file RR entries into the internal format stored in the data field 
    of a 'dnsdbrrrec'.  You have to call dns_types_findrrtype_by_XX () 
    to get the appropriate dnsrrtyperec * to send to this function.

 dns_types_unpack() - 

    This routine translates rdata from the internal DENTS format for RDATA 
    into a string.  

 dns_types_pack_XXX - 
 
    Convenience routines for packing each separate RR type.  Note that
    many of these routines are macro definitions because many RR's
    share the same RDATA format in the packet.

From dns_debug.c  - Debugging support

 dns_debug_dc_to_string() 
  
    Translates the Dents DC_XXX into an ASCII string for the CLASS definition
    used in Resource Records. (The opposite of dns_types_findclass())

 dns_debug_dt_to_string() 
  
    Translates the Dents DT_XXX into an ASCII string for the TYPE
    definition used in Resource Records.
 
 dns_debug_de_to_string() 
  
    Translates the Dents DE_XXX into an ASCII string for the error code.


From addr_tools.c - conversion between human readable and network addresses.

    at_inet4_ntop() 
	return the packed IPv4 address in *ap as a human readable string.

    at_inet6_ntop () 
	return the packed IPv6 address in *ap as a human readable string.

    at_inet4_pton ()
        return the human readable IPv4 string as a packed IPv4 address

    at_inet6_pton ()
        return the human readable IPv6 string as a packed IPv6 address


From event.c - An event queue ordered by time
 
    event_schedule_abs () - Schedule an event to occur at a specified time.
	in the future.
    event_schedule_rel () - Schedule an event to occur at a number of seconds
	relative to the current time.
        

From db.c - an in-memory database based on the RB Tree implementation

    TODO() document db.c


From db_rb.c - an RB Tree implementation

    TODO() document db_rb.c


from dns.c - Dents DNS implementation.

	dns_qualify_domain () - given a domain name, append the default
		domain name if it is unqualified.
    	(should this move to libsupport?)