#ifndef	PERM_H
#define PERM_H

extern hash_tbl *cache2disk,*lastbindhshtbl;
extern hashf_tbl *lastbindpermanent;
extern int max_cachequeue;
extern unsigned long flush_interval,flush_alarm;


/* ANSI function prototypes or empty arg list? */
#ifdef  __STDC__
#define P(args) args
#else
#define P(args) ()
#endif

struct lastbind {
    struct shared_bindata   *cliid;
    struct shared_bindata   *cliidhw;
    struct in_addr          last_ip;
    unsigned long           replys;
    unsigned long           last_touch;
    unsigned long           expire;
    unsigned char           code;
    struct shared_bindata   *vend;
    struct shared_bindata   *user;
    unsigned                clhashcode;
    unsigned                linkcount;
};

/*	A "flat" version of a struct lastbind is an array of unsigned char consisting of each of the members
	of a struct lastbind (in the order above) EXCEPT for clhashcode and linkcount.  Any holes in the
	struct lastbind are not present in the  flat version.
*/
#define LASTBIND_FLAT_MAXLEN (4*SHARED_BINDATA_FLAT_MAXLEN + sizeof(struct in_addr) + 3*sizeof(unsigned long) + sizeof(unsigned char))


extern struct lastbind *data2bind P((hash_datum *, int));
extern void free_lastbind P((hash_datum *));
extern boolean bindfilecmp P((hash_datum *,hash_datum *));
extern boolean lastbindcmp P((hash_datum *a, hash_datum *));
extern boolean lastbindcliidcmp P((hash_datum *,hash_datum *));
extern int update_lastbind P((struct client_info *, struct host*));

#undef P

#endif
