1 /*
2  *  Copyright (C) 2013-2022 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
3  *  Copyright (C) 2007-2013 Sourcefire, Inc.
4  *
5  *  Authors: Mickey Sola
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License version 2 as
9  *  published by the Free Software Foundation.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  *  MA 02110-1301, USA.
20  */
21 
22 #ifndef __ONAS_CLAMONACC_H
23 #define __ONAS_CLAMONACC_H
24 
25 // libclamav
26 #include "clamav.h"
27 
28 #ifndef ONAS_DEBUG
29 #define ONAS_DEBUG
30 #endif
31 /* dev only switch for very noisy output */
32 #undef ONAS_DEBUG
33 
34 #ifndef HAVE_ATTRIB_PACKED
35 #define __attribute__(x)
36 #endif
37 #ifdef HAVE_PRAGMA_PACK
38 #pragma pack(1)
39 #endif
40 #ifdef HAVE_PRAGMA_PACK_HPPA
41 #pragma pack 1
42 #endif
43 
44 struct onas_context {
45     const struct optstruct *opts;
46     const struct optstruct *clamdopts;
47 
48     int printinfected;
49     int maxstream;
50 
51     uint32_t ddd_enabled;
52 
53     int fan_fd;
54     uint64_t fan_mask;
55     uint8_t retry_on_error;
56     uint8_t retry_attempts;
57     uint8_t deny_on_error;
58 
59     uint64_t sizelimit;
60     uint64_t extinfo;
61 
62     int scantype;
63     int isremote;
64     int session;
65     int timeout;
66 
67     int64_t portnum;
68 
69     int32_t maxthreads;
70 } __attribute__((packed));
71 
72 #ifdef HAVE_PRAGMA_PACK
73 #pragma pack()
74 #endif
75 #ifdef HAVE_PRAGMA_PACK_HPPA
76 #pragma pack
77 #endif
78 
79 struct onas_context *onas_init_context(void);
80 void onas_cleanup(struct onas_context *ctx);
81 void onas_context_cleanup(struct onas_context *ctx);
82 cl_error_t onas_check_client_connection(struct onas_context **ctx);
83 int onas_start_eloop(struct onas_context **ctx);
84 void help(void);
85 
86 #endif
87