4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
29 #pragma ident "%Z%%M% %I% %E% SMI"
35 #include <sys/param.h>
36 #include <sys/vnode.h>
39 * vscan.h provides definitions for vscan kernel module
42 #define VS_DRV_PATH "/dev/vscan/vscan" /* append minor dev num */
44 #define VS_IOCTL_ENABLE 0x01 /* door rendezvous */
45 #define VS_IOCTL_DISABLE 0x02 /* vscand shutting down */
46 #define VS_IOCTL_CONFIG 0x03 /* vscand config data update */
47 #define VS_IOCTL_RESULT 0x04 /* scan result */
48 #define VS_IOCTL_MAX_REQ 0x05 /* max in-progress req vscand */
50 /* Scan Result - vsr_result */
51 #define VS_STATUS_UNDEFINED 0
52 #define VS_STATUS_NO_SCAN 1 /* scan not required */
53 #define VS_STATUS_ERROR 2 /* scan failed */
54 #define VS_STATUS_CLEAN 3 /* scan successful, file clean */
55 #define VS_STATUS_INFECTED 4 /* scan successful, file infected */
56 #define VS_STATUS_SCANNING 5 /* scan in progress - async */
58 /* Configuration data vs_config_t - vsc_types */
59 #define VS_TYPES_LEN 4096 /* vs_config_t - types buffer */
60 #define VS_TYPES_MAX VS_TYPES_LEN / 2
64 * AV_SCANSTAMP_SZ is the size of the scanstamp stored in the
65 * filesystem. vs_scanstamp_t is 1 character longer to allow
66 * a null terminated string to be used within vscan
68 typedef char vs_scanstamp_t
[AV_SCANSTAMP_SZ
+ 1];
70 /* used for door request to vscand */
71 typedef struct vs_scan_req
{
77 uint8_t vsr_quarantined
;
78 char vsr_path
[MAXPATHLEN
];
79 vs_scanstamp_t vsr_scanstamp
;
83 /* passed in VS_IOCTL_RESULT - async response from vscand */
84 typedef struct vs_scan_rsp
{
88 vs_scanstamp_t vsr_scanstamp
;
92 /* passed in VS_IOCTL_CONFIG */
93 typedef struct vs_config
{
94 char vsc_types
[VS_TYPES_LEN
];
95 uint64_t vsc_types_len
;
96 uint64_t vsc_max_size
; /* files > max size (bytes) not scan */
97 uint64_t vsc_allow
; /* allow access to file exceeding max_size? */
102 int vscan_svc_init(void);
103 void vscan_svc_fini(void);
104 int vscan_svc_enable(void);
105 void vscan_svc_disable(void);
106 int vscan_svc_configure(vs_config_t
*);
107 boolean_t
vscan_svc_in_use(void);
108 void vscan_svc_scan_result(vs_scan_rsp_t
*);
109 void vscan_svc_scan_abort(void);
110 vnode_t
*vscan_svc_get_vnode(int);
112 int vscan_door_init(void);
113 void vscan_door_fini(void);
114 int vscan_door_open(int);
115 void vscan_door_close(void);
116 int vscan_door_scan_file(vs_scan_req_t
*);
118 boolean_t
vscan_drv_create_node(int);
127 #endif /* _VSCAN_H */