//////////////////////////////////////////////////////////////////
// Image based human verification (as opposed to robot)
// Author: Marijn Weehuizen 
//
// Note: Requires the use of gd graphics library
//       (which in turn requires libpng and zlib)
//		 also requires mutex protection else would have been made a SAM
//////////////////////////////////////////////////////////////////


// Reqd to draw pretty graphs
typedef struct VERIFY_ENTRY {	// Graph description passed in 
	time_t t;

	char *id;			// verification id
	char *text;			// expected text typed by user

	struct VERIFY_ENTRY *next;
} VfyEntry;

// External interface to image verification module
int verify_set_mutex(int (*cb)(int vm, int isget, int seconds), int m);
VfyEntry *vfyimg_new();
int vfyimg_store(VfyEntry *e);
int vfyimg_imgcreate(char* text, void**p, int *size);
int vfyimg_lookupid(char *id, char* text);
int vfyimg_purge();
int vfyimg_free();
int verify_mutex_init(void);
void vfyimg_freemem(void *p);
int vfyimg_init(int orig,int hard);


// Intergnal helper functions
int vfyimg_colfn(int col,int offset, int min, int max);
int qr_create(char* text, void**pret, int *size);
void qr_freemem(void *p);
