/***** **** *** ** *  *   *    *     *       *     *   *  * ** *** **** *****\

    logresolve 2.0 - http://www.net/~tomr/progs/logresolve/

    logresolve.h - configuration & global structures 2.0c5

    Tom Rathborne - tomr@uunet.ca - http://www.net/~tomr/

\***** **** *** ** *  *   *    *     *       *     *   *  * ** *** **** *****/

#ifndef LOGRESOLVE_H
#define LOGRESOLVE_H

/****************************************************************************\
\*** User-configurable things ***********************************************/

/* Turn DBM caching on - comment out to leave it out. */

#define LR_DBM

/* Default DBM filename (typically just a prefix) */

#define LR_DBMNAME "LR"

/* Default lockfile name */

#define LR_LOCKNAME "LR.lock"

/* Input File */

#define LR_INNAME "-"

/* Output File */

#define LR_OUTNAME "-"

/* Statistics File */

#define LR_STATSNAME "="

/* Statistics? */

#define LR_STATS 0

/* Count File */

#define LR_COUNTNAME 0

/* Count? */

#define LR_COUNT 0

/* Expire time for items in cache - in seconds (604800 = 1 week) */

#define LR_EXPIRE 604800

/* Retry time - failed lookups are repeated if they are older than this. */

#define LR_RETRY 30

/* Keep failed lookups in cache? */

#define LR_KEEP 0

/* Number of times to retry IP numbers that gave response TRY_AGAIN */

#define LR_TRIES 4

/* Default number of buckets in cache hash table (passed to lr-hash.h). This * 
 * 
 * * should be big and PRIME, or at least not a power of 2. Maximum useful * * 
 * value is currently 65535. */

#define LR_BUCKETS 4093

/* nice level, for process priority - must be >=0 */

#define LR_NICE 1

/* maximum line length in bytes, including \0 at the end */

#define MAXLINE 4096

/****************************************************************************\
\*** You shouldn't (need to) change anything below this line ****************/

/* Where most of the above #defines go - configuration structure! */

struct lr_opt {
    unsigned char dbm;		/* boolean - using dbm? */
    char *dbmname;		/* name of DBM file */
    char *lockname;		/* name of lockfile */
    char *inname;		/* name of input file */
    char *outname;		/* name of output file */
    char *statsname;		/* name of stats file */
    char *countname;		/* name of total byte count file */
    unsigned int expire;	/* expire time in seconds */
    unsigned int retry;		/* retry delay in seconds */
    unsigned int keep;		/* boolean - cache failed lookups? */
    unsigned int tries;		/* number of times to try */
    unsigned int stats;		/* boolean - print stats? */
    unsigned int count;		/* count - append count? */
    unsigned int buckets;	/* buckets in hash table */
    unsigned int nice;		/* nice level of process */
};

/* Boolean constants - probably defined elsewhere but hey - what the heck! */

#define TRUE 1
#define FALSE 0

/* 
 * Maximum length of an IP number as a string, including \0 
 * (e.g. "255.255.255.255" = 16 bytes)
 */

#define IPSTRLEN 16

/* flags for DBM mode */

#define LR_READ 0
#define LR_WRITE 1
#define LR_CLOSED 2

#endif

/*** end of logresolve.h ***/
