Keywords: clamdoc

Next: Error handling Up: API Previous: Header file Contents

### Database loading

The following set of functions provides an interface for loading the virus database:

    	const char *cl_retdbdir(void);

    	int cl_load(const char *path, struct cl_engine **engine,
    		    unsigned int *signo, unsigned int options);

`cl_retdbdir` returns the default (hardcoded) path to the directory with ClamAV databases. `cl_load` loads a single database file or all databases from a directory (if `path` points to a directory). The second argument is used for passing in the engine structure which should be previously initialized with NULL. A number of loaded signatures will be added to `signo` 7. The last argument can pass the following flags:

- CL_DB_STDOPT
  This is an alias for a recommended set of scan options.
- CL_DB_PHISHING
  Load phishing signatures.
- CL_DB_PHISHING_URLS
  Initialize the phishing detection module and load .wdb and .pdb files.

`cl_load` returns 0 (`CL_SUCCESS`) on success and a non-negative value on failure.

    	    ...
    	    struct cl_engine *engine = NULL;
    	    unsigned int sigs = 0;
    	    int ret;

    	ret = cl_load(cl_retdbdir(), &engine, &sigs, CL_DB_STDOPT);