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

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

    lr-hash.h - hashed memory cache 2.0h1

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

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

#ifndef LR_HASH_H
#define LR_HASH_H

#include "logresolve.h"
#include "lr-nsrec.h"
#include "lr-dbm.h"

struct nstab {
    int size;
    struct nsrec **rec;
};

/* 
 * hash_lookup - gets pointer to record in hash table
 */

struct nsrec *hash_lookup(struct nstab *tab, unsigned char ipnum[4]);

/* 
 * hash_insert - puts record into hash table at front of bucket
 */

void hash_insert(struct nstab *tab, struct nsrec *record);

#ifdef LR_DBM
/* 
 * hash_dumpto_pdbm - dumps hash table to pdbm and closes dbm file
 */

void hash_dumpto_pdbm(struct nstab *tab, char *dbfname, char *lockname, int keep);

#endif

/* 
 * hash_new - makes a new hash table
 */

struct nstab *hash_new(int size);

#endif

/*** end of lr-hash.h ***/
