/* logres.h */

#ifndef _h_logres
#define _h_logres

		/* max length of log record on input */
#define MAX_LINE_IN    3000
		/* max length of domain name */
#define DOMAIN_LEN	200
		/* number of buckets in hash table (was 27449) */
#define HASH_SIZE      49957

/* for command parser: number of words per line, max line length */
#define NCMD_FIELDS	  5
#define CMD_LEN	       1000

#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif

struct IPtable {
	u_long ipaddr;
	char *domain;
	struct IPtable *next;
};

						/* functions */
void addip(unsigned int hashval, u_long ipnum,
	   char *domain);
int find_domain(unsigned int hashval, u_long ipnum, char **domain);

int dump_hash_table(char *hasfilnam);
void load_old_hash_table(char *hasfilnam);
int load_hash_table(char *hasfilnam);

char *e_strdup(char *string);
void *emalloc(int t);
void *dns_timeout(void);
char *lookuphost(struct in_addr *pin, char *ipnam, FILE *err);
void makelower(char *string);
int  greadaline(char logline[], int bufsize, FILE *fp);
void unescape_url(char *url);
char x2c(char *what);
void greadcmdfile(char *cmdfilnam);
void ggetwords(char *buffer, char *word[], int *nwords);
void gDoLoadCommand(void);
void gDoResCommand(char *word[], int nwords);
void gDoDumpCommand(void);
void prtime(void);
void set_ulimit(void);
unsigned int hash(u_long addr);
int write_compressed(FILE **zip, char *outfilname);

#endif
