20
20
<LINK REL="STYLESHEET" HREF="clamdoc.css">
22
<LINK REL="previous" HREF="node41.html">
23
<LINK REL="up" HREF="node38.html">
22
<LINK REL="next" HREF="node47.html">
23
<LINK REL="previous" HREF="node37.html">
24
<LINK REL="up" HREF="node29.html">
24
25
<LINK REL="next" HREF="node43.html">
28
29
<!--Navigation Panel-->
30
31
HREF="node43.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="node41.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="tex2html740"
43
HREF="node43.html">Database reloading</A>
44
<B> Up:</B> <A NAME="tex2html736"
45
HREF="node38.html">API</A>
46
<B> Previous:</B> <A NAME="tex2html732"
47
HREF="node41.html">Error handling</A>
48
  <B> <A NAME="tex2html738"
43
<B> Next:</B> <A NAME="tex2html736"
44
HREF="node43.html">Data scan functions</A>
45
<B> Up:</B> <A NAME="tex2html732"
46
HREF="node29.html">LibClamAV</A>
47
<B> Previous:</B> <A NAME="tex2html726"
48
HREF="node41.html">Engine structure</A>
49
  <B> <A NAME="tex2html734"
49
50
HREF="node1.html">Contents</A></B>
52
53
<!--End of Navigation Panel-->
54
<H3><A NAME="SECTION00074400000000000000">
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>:
61
int cl_build(struct cl_engine *engine);
62
void cl_free(struct cl_engine *engine);
66
if((ret = cl_build(engine))) {
67
printf("cl_build() error: %s\n", cl_strerror(ret));
55
<H2><A NAME="SECTION00074000000000000000">
56
Database reloading</A>
58
The most important thing is to keep the internal instance of the database
59
up to date. You can watch database changes with the <code>cl_stat</code>
62
int cl_statinidir(const char *dirname, struct cl_stat *dbstat);
63
int cl_statchkdir(const struct cl_stat *dbstat);
64
int cl_statfree(struct cl_stat *dbstat);
69
struct cl_stat dbstat;
71
memset(&dbstat, 0, sizeof(struct cl_stat));
72
cl_statinidir(dbdir, &dbstat);
74
To check for a change you just need to call <code>cl_statchkdir</code> and check
77
if(cl_statchkdir(&dbstat) == 1) {
79
cl_statfree(&dbstat);
80
cl_statinidir(cl_retdbdir(), &dbstat);
83
Remember to reset the <code>cl_stat</code> structure after reload.
87
<!--Table of Child-Links-->
88
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>
91
<LI><A NAME="tex2html737"
92
HREF="node43.html">Data scan functions</A>
93
<LI><A NAME="tex2html738"
94
HREF="node44.html">Memory</A>
95
<LI><A NAME="tex2html739"
96
HREF="node45.html">clamav-config</A>
97
<LI><A NAME="tex2html740"
98
HREF="node46.html">Example</A>
100
<!--End of Table of Child-Links-->