/*
** CBLM v3
** $Id: data_hash.h,v 1.12 2007/12/11 06:59:52 sella Exp $
** Copyright (c) 2004-2007 James M. Sella. All Rights Reserved.
** Released under the GPL Version 2 License.
** http://www.digitalgenesis.com
*/

#ifndef __DGS_DATA_HASH_H
#define __DGS_DATA_HASH_H

#include "common.h"
#include "data.h"

#include <arpa/inet.h>

#define HASH_WIDTH 75011 /* Must be prime number. */
#define HASH_ALGO_INT1
//#define HASH_DEBUG

struct hash_entry_t {
	struct data_t *data;
	struct hash_entry_t *next;
};

struct hash_key_t {
	struct hash_entry_t *entry;
	unsigned int depth;
};

/* Public functions */
void hash_init();
void hash_free();
void hash_add(const struct data_t *data);
int hash_del(const struct data_t *data);
struct data_t* hash_find(const struct data_t *data);
int hash_stats_print(void);
int hash_stats(char* stats, size_t len);

/* Private functions. */
unsigned long long hash(const struct data_t *data);

#endif

/*
** Local Variables:
** c-basic-offset: 3
** tab-width: 3
** End:
** vim: noet ts=3 sw=3
*/
