28
29
<DIV CLASS="navigation"><!--Navigation Panel-->
30
31
HREF="node47.html">
31
32
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A>
33
34
HREF="node43.html">
34
35
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A>
36
37
HREF="node45.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="tex2html806"
43
HREF="node47.html">Limits</A>
44
<B> Up:</B> <A NAME="tex2html802"
45
HREF="node43.html">Initialization</A>
46
<B> Previous:</B> <A NAME="tex2html798"
47
HREF="node45.html">Error handling</A>
48
<B> <A NAME="tex2html804"
43
<B> Next:</B> <A NAME="tex2html822"
44
HREF="node47.html">Error handling</A>
45
<B> Up:</B> <A NAME="tex2html818"
46
HREF="node43.html">API</A>
47
<B> Previous:</B> <A NAME="tex2html812"
48
HREF="node45.html">Initialization</A>
49
<B> <A NAME="tex2html820"
49
50
HREF="node1.html">Contents</A></B>
52
53
<!--End of Navigation Panel-->
54
<H3><A NAME="SECTION00074300000000000000">
55
<H3><A NAME="SECTION00073300000000000000">
57
When all required databases are loaded you should prepare the detection
58
engine by calling <code>cl_engine_compile()</code>. In case of failure you
59
should still free the memory allocated to the engine with
60
<code>cl_engine_free()</code>:
58
The following set of functions provides an interface for loading
62
int cl_engine_compile(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
given directory (when <code>path</code> points to a directory). The second
70
argument is used for passing in the pointer to the engine that should
71
be previously allocated with <code>cl_engine_new()</code>. A number of loaded
72
signatures will be <SPAN CLASS="textbf">added</SPAN> to <code>signo</code> <A NAME="tex2html23"
73
HREF="footnode.html#foot336"><SUP><SPAN CLASS="arabic">10</SPAN></SUP></A>. The last argument can
74
pass the following flags:
77
<LI><SPAN CLASS="textbf">CL_DB_STDOPT</SPAN>
79
This is an alias for a recommended set of scan options.
81
<LI><SPAN CLASS="textbf">CL_DB_PHISHING</SPAN>
83
Load phishing signatures.
85
<LI><SPAN CLASS="textbf">CL_DB_PHISHING_URLS</SPAN>
87
Initialize the phishing detection module and load .wdb and .pdb files.
89
<LI><SPAN CLASS="textbf">CL_DB_PUA</SPAN>
91
Load signatures for Potentially Unwanted Applications.
93
<LI><SPAN CLASS="textbf">CL_DB_OFFICIAL_ONLY</SPAN>
95
Only load official signatures from digitally signed databases.
97
<LI><SPAN CLASS="textbf">CL_DB_BYTECODE</SPAN>
103
<code>cl_load()</code> returns <code>CL_SUCCESS</code> on success and another code on
66
if((ret = cl_engine_compile(engine)) != CL_SUCCESS) {
67
printf("cl_engine_compile() error: %s\n", cl_strerror(ret));
68
cl_engine_free(engine);
107
struct cl_engine *engine;
108
unsigned int sigs = 0;
111
if((ret = cl_init()) != CL_SUCCESS) {
112
printf("cl_init() error: %s\n", cl_strerror(ret));
116
if(!(engine = cl_engine_new())) {
117
printf("Can't create new engine\n");
121
ret = cl_load(cl_retdbdir(), engine, &sigs, CL_DB_STDOPT);