next up previous contents
Next: Error handling Up: API Previous: Header file   Contents

Database loading

The following set of functions provides an interface to database initialisation mechanisms:
	int cl_loaddb(const char *filename, struct cl_node **root,
	unsigned int *signo);

	int cl_loaddbdir(const char *dirname, struct cl_node **root,
	unsigned int *signo);

	const char *cl_retdbdir(void);
cl_loaddb loads selected database while cl_loaddbdir loads all databases from a dirname directory. cl_retdbdir returns a default (hardcoded) database directory path. After an initialisation an internal database representation will be saved under root (which must initially point to NULL) and a number of loaded signatures will be added 7 to virnum. You can eventually pass NULL if you don't care about a signature counter. Both cl_loaddb and cl_loaddbdir functions return 0 on success and a non-negative value on failure.
	    ...
	    struct cl_node *root = NULL;
	    int ret, signo = 0;

	ret = cl_loaddbdir(cl_retdbdir(), &root, &signo);



Tomasz Kojm 2004-10-17