21
21
<LINK REL="next" HREF="node51.html">
22
22
<LINK REL="previous" HREF="node49.html">
23
<LINK REL="up" HREF="node48.html">
23
<LINK REL="up" HREF="node43.html">
24
24
<LINK REL="next" HREF="node51.html">
29
29
<DIV CLASS="navigation"><!--Navigation Panel-->
31
31
HREF="node51.html">
32
32
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A>
35
35
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A>
37
37
HREF="node49.html">
38
38
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A>
41
41
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A>
43
<B> Next:</B> <A NAME="tex2html859"
44
HREF="node51.html">Forking daemons</A>
45
<B> Up:</B> <A NAME="tex2html855"
46
HREF="node48.html">Database reloading</A>
47
<B> Previous:</B> <A NAME="tex2html849"
48
HREF="node49.html">Data scan functions</A>
49
<B> <A NAME="tex2html857"
43
<B> Next:</B> <A NAME="tex2html870"
44
HREF="node51.html">Data scan functions</A>
45
<B> Up:</B> <A NAME="tex2html866"
46
HREF="node43.html">API</A>
47
<B> Previous:</B> <A NAME="tex2html860"
48
HREF="node49.html">Limits</A>
49
<B> <A NAME="tex2html868"
50
50
HREF="node1.html">Contents</A></B>
53
53
<!--End of Navigation Panel-->
55
<H3><A NAME="SECTION00076200000000000000">
55
<H3><A NAME="SECTION00073700000000000000">
58
Because the engine structure occupies a few megabytes of system memory, you
59
should release it with <code>cl_engine_free()</code> if you no longer need to
58
It's very important to keep the internal instance of the database up to
59
date. You can watch database changes with the <code>cl_stat..()</code> family
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
75
its return value (0 - no change, 1 - some change occured). Remember to reset
76
the <code>cl_stat</code> structure after reloading the database.
78
if(cl_statchkdir(&dbstat) == 1) {
80
cl_statfree(&dbstat);
81
cl_statinidir(cl_retdbdir(), &dbstat);
84
Libclamav <SPAN CLASS="MATH"><IMG
85
WIDTH="58" HEIGHT="35" ALIGN="MIDDLE" BORDER="0"
87
ALT="$\ge0.96$"></SPAN> includes and additional call to check the number of
88
signatures that can be loaded from a given directory:
90
int cl_countsigs(const char *path, unsigned int countoptions,
93
The first argument points to the database directory, the second one
94
specifies what signatures should be counted:
95
<code>CL_COUNTSIGS_OFFICIAL</code> (official signatures),
96
<BR> <code>CL_COUNTSIGS_UNOFFICIAL</code> (third party signatures),
97
<code>CL_COUNTSIGS_ALL</code> (all signatures). The last argument points
98
to the counter to which the number of detected signatures will
99
be added (therefore the counter should be initially set to 0).
100
The call returns <code>CL_SUCCESS</code> or an error code.