2003-07-29 15:48:06 +00:00
|
|
|
/*
|
2015-09-17 13:41:26 -04:00
|
|
|
* Copyright (C) 2015 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
|
2009-02-13 10:55:45 +00:00
|
|
|
* Copyright (C) 2007-2009 Sourcefire, Inc.
|
|
|
|
*
|
|
|
|
* Authors: Tomasz Kojm, Török Edvin
|
2003-07-29 15:48:06 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
2007-03-31 20:31:04 +00:00
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
2003-07-29 15:48:06 +00:00
|
|
|
*
|
|
|
|
* 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
|
2006-04-09 19:59:28 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
|
|
* MA 02110-1301, USA.
|
2003-07-29 15:48:06 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SCANNER_H
|
|
|
|
#define __SCANNER_H
|
|
|
|
|
2009-08-05 16:27:48 +02:00
|
|
|
#include <sys/types.h>
|
|
|
|
|
2018-07-20 22:28:48 -04:00
|
|
|
#include "libclamav/others.h"
|
2006-09-05 20:45:39 +00:00
|
|
|
#include "libclamav/clamav.h"
|
2008-12-17 21:42:54 +00:00
|
|
|
#include "shared/optparser.h"
|
2009-02-12 16:51:09 +00:00
|
|
|
#include "thrmgr.h"
|
|
|
|
#include "session.h"
|
2003-07-29 15:48:06 +00:00
|
|
|
|
2018-12-03 12:40:13 -05:00
|
|
|
enum scan_type { TYPE_INIT = -1,
|
|
|
|
TYPE_SCAN = 0,
|
|
|
|
TYPE_CONTSCAN = 1,
|
|
|
|
TYPE_MULTISCAN = 2 };
|
2013-03-01 14:01:20 -05:00
|
|
|
|
2009-02-12 16:51:09 +00:00
|
|
|
struct scan_cb_data {
|
|
|
|
int scantype;
|
|
|
|
int odesc;
|
|
|
|
int type;
|
|
|
|
int infected;
|
|
|
|
int errors;
|
|
|
|
int total;
|
|
|
|
int id;
|
|
|
|
const client_conn_t *conn;
|
|
|
|
const char *toplevel_path;
|
|
|
|
unsigned long scanned;
|
2018-07-20 22:28:48 -04:00
|
|
|
struct cl_scan_options *options;
|
2009-02-12 16:51:09 +00:00
|
|
|
struct cl_engine *engine;
|
|
|
|
const struct optstruct *opts;
|
|
|
|
threadpool_t *thr_pool;
|
|
|
|
jobgroup_t *group;
|
2009-08-05 16:27:48 +02:00
|
|
|
dev_t dev;
|
2009-02-12 16:51:09 +00:00
|
|
|
};
|
2003-07-29 15:48:06 +00:00
|
|
|
|
2010-11-02 12:26:33 +02:00
|
|
|
struct cb_context {
|
|
|
|
const char *filename;
|
|
|
|
unsigned long long virsize;
|
|
|
|
char virhash[33];
|
2015-10-01 17:47:37 -04:00
|
|
|
struct scan_cb_data *scandata;
|
2010-11-02 12:26:33 +02:00
|
|
|
};
|
|
|
|
|
2018-07-20 22:28:48 -04:00
|
|
|
int scanfd(const client_conn_t *conn, unsigned long int *scanned, const struct cl_engine *engine, struct cl_scan_options *options, const struct optstruct *opts, int odesc, int stream);
|
|
|
|
int scanstream(int odesc, unsigned long int *scanned, const struct cl_engine *engine, struct cl_scan_options *options, const struct optstruct *opts, char term);
|
2012-07-16 15:36:49 -04:00
|
|
|
int scan_callback(STATBUF *sb, char *filename, const char *msg, enum cli_ftw_reason reason, struct cli_ftw_cbdata *data);
|
2009-07-31 21:28:55 +02:00
|
|
|
int scan_pathchk(const char *path, struct cli_ftw_cbdata *data);
|
2010-11-02 12:26:33 +02:00
|
|
|
void hash_callback(int fd, unsigned long long size, const unsigned char *md5, const char *virname, void *ctx);
|
|
|
|
void msg_callback(enum cl_msg severity, const char *fullmsg, const char *msg, void *ctx);
|
2015-10-01 17:47:37 -04:00
|
|
|
void clamd_virus_found_cb(int fd, const char *virname, void *context);
|
2003-07-29 15:48:06 +00:00
|
|
|
|
|
|
|
#endif
|