61b40ee3 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
73e034df |
|
e79e504d |
<!--Converted with LaTeX2HTML 2008 (1.71) |
73e034df |
original version by: Nikos Drakos, CBLU, University of Leeds
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD> |
e79e504d |
<TITLE>Database loading</TITLE>
<META NAME="description" CONTENT="Database loading"> |
73e034df |
<META NAME="keywords" CONTENT="clamdoc">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
|
e79e504d |
<META NAME="Generator" CONTENT="LaTeX2HTML v2008"> |
73e034df |
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<LINK REL="STYLESHEET" HREF="clamdoc.css">
|
e79e504d |
<LINK REL="next" HREF="node47.html"> |
73e034df |
<LINK REL="previous" HREF="node45.html"> |
ba4cac37 |
<LINK REL="up" HREF="node43.html"> |
73e034df |
<LINK REL="next" HREF="node47.html">
</HEAD>
<BODY > |
61b40ee3 |
<DIV CLASS="navigation"><!--Navigation Panel--> |
e79e504d |
<A NAME="tex2html821" |
73e034df |
HREF="node47.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> |
e79e504d |
<A NAME="tex2html817" |
ba4cac37 |
HREF="node43.html"> |
d8f8e62a |
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> |
e79e504d |
<A NAME="tex2html811" |
73e034df |
HREF="node45.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> |
e79e504d |
<A NAME="tex2html819" |
73e034df |
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A>
<BR> |
e79e504d |
<B> Next:</B> <A NAME="tex2html822"
HREF="node47.html">Error handling</A>
<B> Up:</B> <A NAME="tex2html818"
HREF="node43.html">API</A>
<B> Previous:</B> <A NAME="tex2html812"
HREF="node45.html">Initialization</A>
<B> <A NAME="tex2html820" |
73e034df |
HREF="node1.html">Contents</A></B>
<BR> |
61b40ee3 |
<BR></DIV> |
73e034df |
<!--End of Navigation Panel-->
|
e79e504d |
<H3><A NAME="SECTION00073300000000000000">
Database loading</A> |
73e034df |
</H3> |
e79e504d |
The following set of functions provides an interface for loading
the virus database: |
ba4cac37 |
<PRE> |
e79e504d |
const char *cl_retdbdir(void);
int cl_load(const char *path, struct cl_engine *engine,
unsigned int *signo, unsigned int options); |
ba4cac37 |
</PRE> |
e79e504d |
<code>cl_retdbdir()</code> returns the default (hardcoded) path to the directory
with ClamAV databases.
<code>cl_load()</code> loads a single database file or all databases from a
given directory (when <code>path</code> points to a directory). The second
argument is used for passing in the pointer to the engine that should
be previously allocated with <code>cl_engine_new()</code>. A number of loaded
signatures will be <SPAN CLASS="textbf">added</SPAN> to <code>signo</code> <A NAME="tex2html23"
HREF="footnode.html#foot336"><SUP><SPAN CLASS="arabic">10</SPAN></SUP></A>. The last argument can
pass the following flags:
<UL>
<LI><SPAN CLASS="textbf">CL_DB_STDOPT</SPAN>
<BR>
This is an alias for a recommended set of scan options.
</LI>
<LI><SPAN CLASS="textbf">CL_DB_PHISHING</SPAN>
<BR>
Load phishing signatures.
</LI>
<LI><SPAN CLASS="textbf">CL_DB_PHISHING_URLS</SPAN>
<BR>
Initialize the phishing detection module and load .wdb and .pdb files.
</LI>
<LI><SPAN CLASS="textbf">CL_DB_PUA</SPAN>
<BR>
Load signatures for Potentially Unwanted Applications.
</LI>
<LI><SPAN CLASS="textbf">CL_DB_OFFICIAL_ONLY</SPAN>
<BR>
Only load official signatures from digitally signed databases.
</LI>
<LI><SPAN CLASS="textbf">CL_DB_BYTECODE</SPAN>
<BR>
Load bytecode.
</LI>
</UL>
<code>cl_load()</code> returns <code>CL_SUCCESS</code> on success and another code on
failure. |
ba4cac37 |
<PRE> |
e79e504d |
...
struct cl_engine *engine;
unsigned int sigs = 0;
int ret;
if((ret = cl_init()) != CL_SUCCESS) {
printf("cl_init() error: %s\n", cl_strerror(ret));
return 1;
}
if(!(engine = cl_engine_new())) {
printf("Can't create new engine\n"); |
ba4cac37 |
return 1;
} |
e79e504d |
ret = cl_load(cl_retdbdir(), engine, &sigs, CL_DB_STDOPT); |
ba4cac37 |
</PRE> |
73e034df |
<P>
<BR><HR>
<ADDRESS>
Tomasz Kojm |
1d15fd32 |
2010-05-19 |
73e034df |
</ADDRESS>
</BODY>
</HTML> |