ClamAV 1.5.3
ClamAV open source email, web, and end-point anti-virus toolkit.
Loading...
Searching...
No Matches
libfreshclam.h
1/*
2 * Copyright (C) 2013-2025 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 const char *certsDirectory;
67} fc_config;
68
69typedef enum fc_error_tag {
70 FC_SUCCESS = 0,
71 FC_UPTODATE = 1,
72 FC_EINIT,
73 FC_EDIRECTORY,
74 FC_EFILE,
75 FC_ECONNECTION,
76 FC_EEMPTYFILE,
77 FC_EBADCVD,
78 FC_ETESTFAIL,
79 FC_ECONFIG,
80 FC_EDBDIRACCESS,
81 FC_EFAILEDGET,
82 FC_EMIRRORNOTSYNC,
83 FC_ELOGGING,
84 FC_EFAILEDUPDATE,
85 FC_EMEM,
86 FC_EARG,
87 FC_EFORBIDDEN,
88 FC_ERETRYLATER,
89 FC_ERROR
90} fc_error_t;
91
98const char *fc_strerror(fc_error_t fcerror);
99
114fc_error_t fc_initialize(fc_config *config);
115
123void fc_cleanup(void);
124
136fc_error_t fc_prune_database_directory(
137 char **databaseList,
138 uint32_t nDatabases);
139
148fc_error_t fc_test_database(
149 const char *dbFilename,
150 int bBytecodeEnabled);
151
164fc_error_t fc_dns_query_update_info(
165 const char *dnsUpdateInfoServer,
166 char **dnsUpdateInfo,
167 char **newVersion);
168
179fc_error_t fc_download_url_database(
180 const char *urlDatabase,
181 void *context,
182 int *bUpdated);
183
193fc_error_t fc_download_url_databases(
194 char **urlDatabaseList,
195 uint32_t nUrlDatabases,
196 void *context,
197 uint32_t *nUpdated);
198
211fc_error_t fc_update_database(
212 const char *database,
213 char **serverList,
214 uint32_t nServers,
215 int bPrivateMirror,
216 const char *dnsUpdateInfo,
217 int bScriptedUpdates,
218 void *context,
219 int *bUpdated);
220
234fc_error_t fc_update_databases(
235 char **databaseList,
236 uint32_t nDatabases,
237 char **serverList,
238 uint32_t nServers,
239 int bPrivateMirror,
240 const char *dnsUpdateInfo,
241 int bScriptedUpdates,
242 void *context,
243 uint32_t *nUpdated);
244
245/* ----------------------------------------------------------------------------
246 * Callback function type definitions.
247 */
248
260typedef fc_error_t (*fccb_download_complete)(const char *dbFilename, void *context);
266extern void fc_set_fccb_download_complete(fccb_download_complete callback);
267
268#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
bool bFipsLimits
Definition libfreshclam.h:65
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 * certsDirectory
Definition libfreshclam.h:63
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