Skip to content

simta/denser

Repository files navigation

This file contains an outline of the basic denser API.

DNSR dnsr_init()
    Returns a DNSR ( can be a struct or a type def - my call ).

    Reads the config file - long running jobs will not get updates to conf.

int dnsr_query( DNSR dnsr, int nstype, char *dn )
    This function takes three arguments:

    * A DNSR.

    * An integer value defining the type of the rr requested.
      These values are defined in denser.h and all begin with "DNSR_TYPE_".
      ( RFC 1035 3.2.2 - 3.2.3 )

    * The domain name to be queried.

    dnsr_query() assembles and sends the query ( one frame ) from these
    arguments.  This function then returns immediately without waiting
    for the reply.

    Time of query is noted in dnsr.

    return values:
	-1	fatal error
	0	success
	1	partial error

int dnsr_result( DNSR dnsr, struct timeval *timeout )
    This function takes two arguments:

    * A DNSR that's been primed with a previous call to dnsr_query().

    * A pointer to a timeval indicating the maximum time that this function
      is allowed to spend assembling queries and waiting for replies.

    Listens for responses and generates new queries as necessary.
    Keeps track of both the count of queries and the total time
    spent making these queries.

    If the timeout is NULL, this function blocks until
    the query is completed. The return value will then indicate sucess
    or failure.

    *** With NULL time, should we return after going through all the states
    *** or start over until we get a response?

    If a result is found, this function fills the data section in the given
    handle with the data from the reply.

    The return value is used to indicate the status of dnsr_result, if
    the function has completed it's operation and failed, completed and
    suceeded, wasn't able to complete the operation in the time allocated
    to it with it's timeval or wasn't able to complete the operation because
    of a temporary failure ( RFC 1034 5.2.3 ).

    Errors ( RFC 1034 5.2.1 ):
	* name error ( NE ) - name not found
	* data not found error - name found, but requested data type was not

    Alias ( RFC 1034 5.2.2 ):
	An alias condition should be returned to the client if the given name
	is found to be an alias.

	In the general function, aliases should not be followed to allow
	for alias existance queries.

    If timeout is non-NULL, then the timeval pointed to by timeout is
    decremented by the amount of time actually spent in this function.

    After a sucessful call to dnsr_result() dnsr_response will contain the
    response.

int dnsr_parse( DNSR dnsr, int section, int type, char *buf, int size )
    This function takes seven arguments:

    A DNSR that contains a response. dnsr_result() must have
    been called successfully on this DNSR for this to be true.

    An integer defining a section number to look for the response in.
    This will be one of HEADER, QUESTION, ANSWER, AUTHORITY, or ADDITIONAL.

    An integer value defining the type of the rr sought within the response.
    These values are defined in denser.h and all begin with "DEN_T_".

    A character buffer used to store the requested information.

    An integer value giving the size of the buffer.

    On success, this function returns the number of byte writte to buf, or
    an error code to indicate the reason for failure.

    All data returned by this function will be in an uncompressed state.

void dnsr_free( DNSR )
    Disposes of a handle previously created by dnsr_open.

Goals:
    We want this API to work in an object oriented fashion. That is,
    we want the innards of the API to be unknown to the user, and
    we want "Public" functions declared that will do all the operations
    on the internal structures.

    We want this API to be thread-safe. No data should be stored
    statically within the function, all state should be saved within
    the DenseData.

    To off these client-stub-resolver interfaces ( RFC 1034 5.2.1 ):

	* Host name to host address translation
	* Host address to host name translation
	* General lookup function

These user functions will be provided an interface to the denser api:

struct hostent *gethostbyname( const char *name )

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages