ClamAV 1.0.4
ClamAV open source email, web, and end-point anti-virus toolkit.
Loading...
Searching...
No Matches
libfreshclam.h
1/*
2 * Copyright (C) 2013-2022 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
3 * Copyright (C) 2007-2013 Sourcefire, Inc.
4 * Copyright (C) 2002-2007 Tomasz Kojm <tkojm@clamav.net>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 * MA 02110-1301, USA.
19 */
20
21#ifndef __LIBFRESHCLAM_H
22#define __LIBFRESHCLAM_H
23
24#include "clamav-types.h"
25
26/*
27 * FreshClam configuration flag options.
28 */
29// clang-format off
30#define FC_CONFIG_MSG_DEBUG 0x1 // Enable debug messages.
31#define FC_CONFIG_MSG_VERBOSE 0x2 // Enable verbose mode.
32#define FC_CONFIG_MSG_QUIET 0x4 // Only output error messages.
33#define FC_CONFIG_MSG_NOWARN 0x8 // Don't output warning messages.
34#define FC_CONFIG_MSG_STDOUT 0x10 // Write to stdout instead of stderr.
35#define FC_CONFIG_MSG_SHOWPROGRESS 0x20 // Show download progress percentage.
36
37#define FC_CONFIG_LOG_VERBOSE 0x1 // Be verbose in log output as well.
38#define FC_CONFIG_LOG_NOWARN 0x2 // Don't log warning messages.
39#define FC_CONFIG_LOG_TIME 0x4 // Include timestamp in log messages.
40#define FC_CONFIG_LOG_ROTATE 0x8 // Rotate logs if they exceed MaxLogSize.
41#define FC_CONFIG_LOG_SYSLOG 0x10 // Enable Syslog.
42// clang-format on
43
44/* freshclam config options */
45typedef struct fc_config_ {
46 uint32_t msgFlags;
47 uint32_t logFlags;
48 uint64_t maxLogSize;
49 uint32_t maxAttempts;
50 uint32_t connectTimeout;
51 uint32_t requestTimeout;
53 const char *logFile;
54 const char *logFacility;
55 const char *localIP;
56 const char *userAgent;
57 const char *proxyServer;
58 uint16_t proxyPort;
59 const char *proxyUsername;
60 const char *proxyPassword;
61 const char *databaseDirectory;
62 const char *tempDirectory;
63} fc_config;
64
65typedef enum fc_error_tag {
66 FC_SUCCESS = 0,
67 FC_UPTODATE = 1,
68 FC_EINIT,
69 FC_EDIRECTORY,
70 FC_EFILE,
71 FC_ECONNECTION,
72 FC_EEMPTYFILE,
73 FC_EBADCVD,
74 FC_ETESTFAIL,
75 FC_ECONFIG,
76 FC_EDBDIRACCESS,
77 FC_EFAILEDGET,
78 FC_EMIRRORNOTSYNC,
79 FC_ELOGGING,
80 FC_EFAILEDUPDATE,
81 FC_EMEM,
82 FC_EARG,
83 FC_EFORBIDDEN,
84 FC_ERETRYLATER,
85 FC_ERROR
86} fc_error_t;
87
94const char *fc_strerror(fc_error_t fcerror);
95
110fc_error_t fc_initialize(fc_config *config);
111
119void fc_cleanup(void);
120
132fc_error_t fc_prune_database_directory(
133 char **databaseList,
134 uint32_t nDatabases);
135
144fc_error_t fc_test_database(
145 const char *dbFilename,
146 int bBytecodeEnabled);
147
160fc_error_t fc_dns_query_update_info(
161 const char *dnsUpdateInfoServer,
162 char **dnsUpdateInfo,
163 char **newVersion);
164
175fc_error_t fc_download_url_database(
176 const char *urlDatabase,
177 void *context,
178 int *bUpdated);
179
189fc_error_t fc_download_url_databases(
190 char **urlDatabaseList,
191 uint32_t nUrlDatabases,
192 void *context,
193 uint32_t *nUpdated);
194
207fc_error_t fc_update_database(
208 const char *database,
209 char **serverList,
210 uint32_t nServers,
211 int bPrivateMirror,
212 const char *dnsUpdateInfo,
213 int bScriptedUpdates,
214 void *context,
215 int *bUpdated);
216
230fc_error_t fc_update_databases(
231 char **databaseList,
232 uint32_t nDatabases,
233 char **serverList,
234 uint32_t nServers,
235 int bPrivateMirror,
236 const char *dnsUpdateInfo,
237 int bScriptedUpdates,
238 void *context,
239 uint32_t *nUpdated);
240
241/* ----------------------------------------------------------------------------
242 * Callback function type definitions.
243 */
244
256typedef fc_error_t (*fccb_download_complete)(const char *dbFilename, void *context);
262extern void fc_set_fccb_download_complete(fccb_download_complete callback);
263
264#endif // __LIBFRESHCLAM_H
Definition libfreshclam.h:45
uint32_t maxAttempts
Definition libfreshclam.h:49
const char * logFile
Definition libfreshclam.h:53
uint32_t connectTimeout
Definition libfreshclam.h:50
const char * proxyPassword
Definition libfreshclam.h:60
uint32_t requestTimeout
Definition libfreshclam.h:51
uint32_t bCompressLocalDatabase
Definition libfreshclam.h:52
uint64_t maxLogSize
Definition libfreshclam.h:48
uint16_t proxyPort
Definition libfreshclam.h:58
uint32_t msgFlags
Definition libfreshclam.h:46
uint32_t logFlags
Definition libfreshclam.h:47
const char * databaseDirectory
Definition libfreshclam.h:61
const char * tempDirectory
Definition libfreshclam.h:62
const char * proxyUsername
Definition libfreshclam.h:59
const char * proxyServer
Definition libfreshclam.h:57
const char * userAgent
Definition libfreshclam.h:56
const char * localIP
Definition libfreshclam.h:55
const char * logFacility
Definition libfreshclam.h:54