libclamav/scanners.h
85dd8460
 /*
c442ca9c
  *  Copyright (C) 2013-2019 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
221825fd
  *  Copyright (C) 2007-2013 Sourcefire, Inc.
c7543866
  *
2023340a
  *  Authors: Tomasz Kojm
85dd8460
  *
  *  This program is free software; you can redistribute it and/or modify
bb34cb31
  *  it under the terms of the GNU General Public License version 2 as
  *  published by the Free Software Foundation.
85dd8460
  *
  *  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
48b7b4a7
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  *  MA 02110-1301, USA.
85dd8460
  */
 
 #ifndef __SCANNERS_H
 #define __SCANNERS_H
 
 #include "clamav.h"
3c91998b
 #include "others.h"
7770d314
 #include "filetypes.h"
85dd8460
 
d39cb658
 /**
  * @brief   Scan a tempfile / sub-file of _any_ type, passing in the fd, filepath (if available), and the scanning context.
  * 
  * @param desc      File descriptor
  * @param filepath  (optional) Full file path.
  * @param ctx       Scanning context structure.
  * @return int      CL_SUCCESS, or an error code.
  */
 int cli_magic_scandesc(int desc, const char *filepath, cli_ctx *ctx);
 
 /**
  * @brief   Like cli_magic_scandesc(), but where the file type is known to be a partition.
  * 
  * @param desc      File descriptor
  * @param filepath  (optional) Full file path.
  * @param ctx       Scanning context structure.
  * @return int      CL_SUCCESS, or an error code.
  */
 int cli_partition_scandesc(int desc, const char *filepath, cli_ctx *ctx);
 
b7ae31f1
 int cli_magic_scandesc_type(cli_ctx *ctx, cli_file_t type);
d39cb658
 
 /**
  * @brief   Scan an offset/length into a file map.
  * 
  * For map scans that are not forced to disk.
  * 
  * @param map       File map.
  * @param offset    Offset into file map.
  * @param length    Length from offset.
  * @param ctx       Scanning context structure.
  * @param type      CL_TYPE of data to be scanned.
  * @return int      CL_SUCCESS, or an error code.
  */
328a3325
 int cli_map_scandesc(cl_fmap_t *map, off_t offset, size_t length, cli_ctx *ctx, cli_file_t type);
d39cb658
 
 /**
  * @brief   Scan an offset/length into a file map.
  * 
  * Like cli_man_scandesc(), but for map scans that may be forced to disk.
  * 
  * @param map       File map.
  * @param offset    Offset into file map.
  * @param length    Length from offset.
  * @param ctx       Scanning context structure.
  * @param type      CL_TYPE of data to be scanned.
  * @return int      CL_SUCCESS, or an error code.
  */
328a3325
 int cli_map_scan(cl_fmap_t *map, off_t offset, size_t length, cli_ctx *ctx, cli_file_t type);
d39cb658
 
 /**
  * @brief   Convenience wrapper for cli_map_scan().
  * 
  * Creates an fmap and calls cli_map_scan() for you, with type CL_TYPE_ANY.
  * 
  * @param buffer    Pointer to the buffer to be scanned.
  * @param length    Size in bytes of the buffer being scanned.
  * @param ctx       Scanning context structure.
  * @return int      CL_SUCCESS, or an error code.
  */
b3a8f998
 int cli_mem_scandesc(const void *buffer, size_t length, cli_ctx *ctx);
d39cb658
 
7f0d1148
 int cli_found_possibly_unwanted(cli_ctx* ctx);
85dd8460
 
 #endif