libfreshclam.h
/*
* Copyright (C) 2013-2025 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
* Copyright (C) 2007-2013 Sourcefire, Inc.
* Copyright (C) 2002-2007 Tomasz Kojm <tkojm@clamav.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#ifndef __LIBFRESHCLAM_H
#define __LIBFRESHCLAM_H
#include "clamav-types.h"
/*
* FreshClam configuration flag options.
*/
// clang-format off
#define FC_CONFIG_MSG_DEBUG 0x1 // Enable debug messages.
#define FC_CONFIG_MSG_VERBOSE 0x2 // Enable verbose mode.
#define FC_CONFIG_MSG_QUIET 0x4 // Only output error messages.
#define FC_CONFIG_MSG_NOWARN 0x8 // Don't output warning messages.
#define FC_CONFIG_MSG_STDOUT 0x10 // Write to stdout instead of stderr.
#define FC_CONFIG_MSG_SHOWPROGRESS 0x20 // Show download progress percentage.
#define FC_CONFIG_LOG_VERBOSE 0x1 // Be verbose in log output as well.
#define FC_CONFIG_LOG_NOWARN 0x2 // Don't log warning messages.
#define FC_CONFIG_LOG_TIME 0x4 // Include timestamp in log messages.
#define FC_CONFIG_LOG_ROTATE 0x8 // Rotate logs if they exceed MaxLogSize.
#define FC_CONFIG_LOG_SYSLOG 0x10 // Enable Syslog.
// clang-format on
/* freshclam config options */
typedef struct fc_config_ {
uint32_t msgFlags;
uint32_t logFlags;
uint64_t maxLogSize;
uint32_t maxAttempts;
uint32_t connectTimeout;
uint32_t requestTimeout;
uint32_t bCompressLocalDatabase;
const char *logFile;
const char *logFacility;
const char *localIP;
const char *userAgent;
const char *proxyServer;
uint16_t proxyPort;
const char *proxyUsername;
const char *proxyPassword;
const char *databaseDirectory;
const char *tempDirectory;
const char *certsDirectory;
bool bFipsLimits;
} fc_config;
typedef enum fc_error_tag {
FC_SUCCESS = 0,
FC_UPTODATE = 1,
FC_EINIT,
FC_EDIRECTORY,
FC_EFILE,
FC_ECONNECTION,
FC_EEMPTYFILE,
FC_EBADCVD,
FC_ETESTFAIL,
FC_ECONFIG,
FC_EDBDIRACCESS,
FC_EFAILEDGET,
FC_EMIRRORNOTSYNC,
FC_ELOGGING,
FC_EFAILEDUPDATE,
FC_EMEM,
FC_EARG,
FC_EFORBIDDEN,
FC_ERETRYLATER,
FC_ERROR
} fc_error_t;
const char *fc_strerror(fc_error_t fcerror);
fc_error_t fc_initialize(fc_config *config);
void fc_cleanup(void);
fc_error_t fc_prune_database_directory(
char **databaseList,
uint32_t nDatabases);
fc_error_t fc_test_database(
const char *dbFilename,
int bBytecodeEnabled);
fc_error_t fc_dns_query_update_info(
const char *dnsUpdateInfoServer,
char **dnsUpdateInfo,
char **newVersion);
fc_error_t fc_download_url_database(
const char *urlDatabase,
void *context,
int *bUpdated);
fc_error_t fc_download_url_databases(
char **urlDatabaseList,
uint32_t nUrlDatabases,
void *context,
uint32_t *nUpdated);
fc_error_t fc_update_database(
const char *database,
char **serverList,
uint32_t nServers,
int bPrivateMirror,
const char *dnsUpdateInfo,
int bScriptedUpdates,
void *context,
int *bUpdated);
fc_error_t fc_update_databases(
char **databaseList,
uint32_t nDatabases,
char **serverList,
uint32_t nServers,
int bPrivateMirror,
const char *dnsUpdateInfo,
int bScriptedUpdates,
void *context,
uint32_t *nUpdated);
/* ----------------------------------------------------------------------------
* Callback function type definitions.
*/
typedef fc_error_t (*fccb_download_complete)(const char *dbFilename, void *context);
extern void fc_set_fccb_download_complete(fccb_download_complete callback);
#endif // __LIBFRESHCLAM_H
fc_config_
Definition: libfreshclam.h:45
fc_config_::maxAttempts
uint32_t maxAttempts
Definition: libfreshclam.h:49
fc_config_::logFile
const char * logFile
Definition: libfreshclam.h:53
fc_config_::connectTimeout
uint32_t connectTimeout
Definition: libfreshclam.h:50
fc_config_::proxyPassword
const char * proxyPassword
Definition: libfreshclam.h:60
fc_config_::requestTimeout
uint32_t requestTimeout
Definition: libfreshclam.h:51
fc_config_::bCompressLocalDatabase
uint32_t bCompressLocalDatabase
Definition: libfreshclam.h:52
fc_config_::maxLogSize
uint64_t maxLogSize
Definition: libfreshclam.h:48
fc_config_::proxyPort
uint16_t proxyPort
Definition: libfreshclam.h:58
fc_config_::bFipsLimits
bool bFipsLimits
Definition: libfreshclam.h:65
fc_config_::msgFlags
uint32_t msgFlags
Definition: libfreshclam.h:46
fc_config_::logFlags
uint32_t logFlags
Definition: libfreshclam.h:47
fc_config_::databaseDirectory
const char * databaseDirectory
Definition: libfreshclam.h:61
fc_config_::tempDirectory
const char * tempDirectory
Definition: libfreshclam.h:62
fc_config_::certsDirectory
const char * certsDirectory
Definition: libfreshclam.h:63
fc_config_::proxyUsername
const char * proxyUsername
Definition: libfreshclam.h:59
fc_config_::proxyServer
const char * proxyServer
Definition: libfreshclam.h:57
fc_config_::userAgent
const char * userAgent
Definition: libfreshclam.h:56
fc_config_::localIP
const char * localIP
Definition: libfreshclam.h:55
fc_config_::logFacility
const char * logFacility
Definition: libfreshclam.h:54