/*
 * $Id: defines.h,v 1.5 2004/03/06 01:47:09 anthonyu Exp $
 */

#define SIZE	64

enum {
	GOOD_TICKET,
	NO_TICKET,
	BAD_TICKET,
	SERVER_ERR
};

typedef struct {
	unsigned int authenticache_on;
	unsigned int authenticache_authoritative;
	unsigned int authenticache_ttl;
	unsigned int authenticache_maxttl;
	char *authenticache_tname;
	char *authenticache_tpath;
	unsigned int authenticache_verify_ip;
} authenticache_cfg;


static char *authenticache_hmac(apr_pool_t *, char *);
static char *ap_hmac_md5(apr_pool_t *, char *, unsigned char *,
		unsigned char *);
static int authenticache_valid_ticket(request_rec *, authenticache_cfg *,
		apr_table_t *);
static int authenticache_set_cookie(request_rec *, char *, char *,
		unsigned int, char *);
static int authenticache_parse_cookie(request_rec *, authenticache_cfg *,
		apr_table_t *);
static int authenticache_init(apr_pool_t *, apr_pool_t *, apr_pool_t *,
		server_rec *);

#if !APR_HAS_RANDOM
#	if !defined(DEVRANDOM)
		char randbyte(void);
#	endif
#endif

APR_DECLARE_OPTIONAL_FN(int,authenticache_set_cookie,(request_rec *, char *, char *, unsigned int, char *));
APR_DECLARE_OPTIONAL_FN(char *,authenticache_hmac,(apr_pool_t *, char *));
