19
19
<LINK REL="STYLESHEET" HREF="clamdoc.css">
21
<LINK REL="next" HREF="node42.html">
21
22
<LINK REL="previous" HREF="node40.html">
22
<LINK REL="up" HREF="node37.html">
23
<LINK REL="up" HREF="node39.html">
23
24
<LINK REL="next" HREF="node42.html">
28
29
<DIV CLASS="navigation"><!--Navigation Panel-->
30
31
HREF="node42.html">
31
32
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A>
34
35
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A>
36
37
HREF="node40.html">
37
38
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A>
40
41
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A>
42
<B> Next:</B> <A NAME="tex2html725"
43
HREF="node42.html">Database reloading</A>
44
<B> Up:</B> <A NAME="tex2html721"
45
HREF="node37.html">API</A>
46
<B> Previous:</B> <A NAME="tex2html717"
47
HREF="node40.html">Error handling</A>
48
<B> <A NAME="tex2html723"
43
<B> Next:</B> <A NAME="tex2html738"
44
HREF="node42.html">Error handling</A>
45
<B> Up:</B> <A NAME="tex2html734"
46
HREF="node39.html">API</A>
47
<B> Previous:</B> <A NAME="tex2html728"
48
HREF="node40.html">Header file</A>
49
<B> <A NAME="tex2html736"
49
50
HREF="node1.html">Contents</A></B>
52
53
<!--End of Navigation Panel-->
54
<H3><A NAME="SECTION00073400000000000000">
55
<H3><A NAME="SECTION00073200000000000000">
57
When all required databases are loaded you should prepare the detection
58
engine by calling <code>cl_build</code>. In the case of failure you should
59
free the memory occupied by the engine with <code>cl_free</code>:
58
The following set of functions provides an interface for loading
61
int cl_build(struct cl_engine *engine);
62
void cl_free(struct cl_engine *engine);
61
const char *cl_retdbdir(void);
63
int cl_load(const char *path, struct cl_engine **engine,
64
unsigned int *signo, unsigned int options);
66
<code>cl_retdbdir</code> returns the default (hardcoded) path to the directory
67
with ClamAV databases.
68
<code>cl_load</code> loads a single database file or all databases from a
69
directory (if <code>path</code> points to a directory). The second argument
70
is used for passing in the engine structure which should be previously
71
initialized with NULL. A number of loaded signatures will be <SPAN CLASS="textbf">added</SPAN>
72
to <code>signo</code> <A NAME="tex2html20"
73
HREF="footnode.html#foot313"><SUP><SPAN CLASS="arabic">8</SPAN></SUP></A>. The last argument can pass the following flags:
76
<LI><SPAN CLASS="textbf">CL_DB_STDOPT</SPAN>
78
This is an alias for a recommended set of scan options.
80
<LI><SPAN CLASS="textbf">CL_DB_PHISHING</SPAN>
82
Load phishing signatures.
84
<LI><SPAN CLASS="textbf">CL_DB_PHISHING_URLS</SPAN>
86
Initialize the phishing detection module and load .wdb and .pdb files.
88
<LI><SPAN CLASS="textbf">CL_DB_PUA</SPAN>
90
Load signatures for Potentially Unwanted Applications.
92
<LI><SPAN CLASS="textbf">CL_DB_CVDNOTMP</SPAN>
94
Load CVD files directly without unpacking them into a temporary
99
<code>cl_load</code> returns 0 (<code>CL_SUCCESS</code>) on success and a negative
66
if((ret = cl_build(engine))) {
67
printf("cl_build() error: %s\n", cl_strerror(ret));
103
struct cl_engine *engine = NULL;
104
unsigned int sigs = 0;
107
ret = cl_load(cl_retdbdir(), &engine, &sigs, CL_DB_STDOPT);