vscan.h revision bfc848c632c9eacb2a640246d96e198f1b185c03
911106dfb16696472af8c1b7b4c554a829354fa8jm/*
911106dfb16696472af8c1b7b4c554a829354fa8jm * CDDL HEADER START
911106dfb16696472af8c1b7b4c554a829354fa8jm *
911106dfb16696472af8c1b7b4c554a829354fa8jm * The contents of this file are subject to the terms of the
911106dfb16696472af8c1b7b4c554a829354fa8jm * Common Development and Distribution License (the "License").
911106dfb16696472af8c1b7b4c554a829354fa8jm * You may not use this file except in compliance with the License.
911106dfb16696472af8c1b7b4c554a829354fa8jm *
911106dfb16696472af8c1b7b4c554a829354fa8jm * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
911106dfb16696472af8c1b7b4c554a829354fa8jm * or http://www.opensolaris.org/os/licensing.
911106dfb16696472af8c1b7b4c554a829354fa8jm * See the License for the specific language governing permissions
911106dfb16696472af8c1b7b4c554a829354fa8jm * and limitations under the License.
911106dfb16696472af8c1b7b4c554a829354fa8jm *
911106dfb16696472af8c1b7b4c554a829354fa8jm * When distributing Covered Code, include this CDDL HEADER in each
911106dfb16696472af8c1b7b4c554a829354fa8jm * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
911106dfb16696472af8c1b7b4c554a829354fa8jm * If applicable, add the following below this CDDL HEADER, with the
911106dfb16696472af8c1b7b4c554a829354fa8jm * fields enclosed by brackets "[]" replaced with your own identifying
911106dfb16696472af8c1b7b4c554a829354fa8jm * information: Portions Copyright [yyyy] [name of copyright owner]
911106dfb16696472af8c1b7b4c554a829354fa8jm *
911106dfb16696472af8c1b7b4c554a829354fa8jm * CDDL HEADER END
911106dfb16696472af8c1b7b4c554a829354fa8jm */
911106dfb16696472af8c1b7b4c554a829354fa8jm/*
53c110294d8b1410cabc201a52f94b03ae2ef448jm * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
911106dfb16696472af8c1b7b4c554a829354fa8jm * Use is subject to license terms.
911106dfb16696472af8c1b7b4c554a829354fa8jm */
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm#ifndef _VSCAN_H
911106dfb16696472af8c1b7b4c554a829354fa8jm#define _VSCAN_H
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm#pragma ident "%Z%%M% %I% %E% SMI"
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm#ifdef __cplusplus
911106dfb16696472af8c1b7b4c554a829354fa8jmextern "C" {
911106dfb16696472af8c1b7b4c554a829354fa8jm#endif
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm#include <sys/param.h>
911106dfb16696472af8c1b7b4c554a829354fa8jm#include <sys/vnode.h>
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm/*
911106dfb16696472af8c1b7b4c554a829354fa8jm * vscan.h provides definitions for vscan kernel module
911106dfb16696472af8c1b7b4c554a829354fa8jm */
911106dfb16696472af8c1b7b4c554a829354fa8jm
bfc848c632c9eacb2a640246d96e198f1b185c03jm#define VS_DRV_PATH "/dev/vscan/vscan" /* append minor dev num */
bfc848c632c9eacb2a640246d96e198f1b185c03jm
bfc848c632c9eacb2a640246d96e198f1b185c03jm#define VS_IOCTL_ENABLE 0x01 /* door rendezvous */
bfc848c632c9eacb2a640246d96e198f1b185c03jm#define VS_IOCTL_DISABLE 0x02 /* vscand shutting down */
bfc848c632c9eacb2a640246d96e198f1b185c03jm#define VS_IOCTL_CONFIG 0x03 /* vscand config data update */
bfc848c632c9eacb2a640246d96e198f1b185c03jm#define VS_IOCTL_RESULT 0x04 /* scan result */
bfc848c632c9eacb2a640246d96e198f1b185c03jm#define VS_IOCTL_MAX_REQ 0x05 /* max in-progress req vscand */
911106dfb16696472af8c1b7b4c554a829354fa8jm
53c110294d8b1410cabc201a52f94b03ae2ef448jm/* Scan Result - vsr_result */
53c110294d8b1410cabc201a52f94b03ae2ef448jm#define VS_STATUS_UNDEFINED 0
bfc848c632c9eacb2a640246d96e198f1b185c03jm#define VS_STATUS_NO_SCAN 1 /* scan not required */
bfc848c632c9eacb2a640246d96e198f1b185c03jm#define VS_STATUS_ERROR 2 /* scan failed */
bfc848c632c9eacb2a640246d96e198f1b185c03jm#define VS_STATUS_CLEAN 3 /* scan successful, file clean */
bfc848c632c9eacb2a640246d96e198f1b185c03jm#define VS_STATUS_INFECTED 4 /* scan successful, file infected */
bfc848c632c9eacb2a640246d96e198f1b185c03jm#define VS_STATUS_SCANNING 5 /* scan in progress - async */
911106dfb16696472af8c1b7b4c554a829354fa8jm
bfc848c632c9eacb2a640246d96e198f1b185c03jm/* Configuration data vs_config_t - vsc_types */
911106dfb16696472af8c1b7b4c554a829354fa8jm#define VS_TYPES_LEN 4096 /* vs_config_t - types buffer */
bfc848c632c9eacb2a640246d96e198f1b185c03jm#define VS_TYPES_MAX VS_TYPES_LEN / 2
bfc848c632c9eacb2a640246d96e198f1b185c03jm
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm/*
911106dfb16696472af8c1b7b4c554a829354fa8jm * AV_SCANSTAMP_SZ is the size of the scanstamp stored in the
911106dfb16696472af8c1b7b4c554a829354fa8jm * filesystem. vs_scanstamp_t is 1 character longer to allow
911106dfb16696472af8c1b7b4c554a829354fa8jm * a null terminated string to be used within vscan
911106dfb16696472af8c1b7b4c554a829354fa8jm */
911106dfb16696472af8c1b7b4c554a829354fa8jmtypedef char vs_scanstamp_t[AV_SCANSTAMP_SZ + 1];
911106dfb16696472af8c1b7b4c554a829354fa8jm
bfc848c632c9eacb2a640246d96e198f1b185c03jm/* used for door request to vscand */
911106dfb16696472af8c1b7b4c554a829354fa8jmtypedef struct vs_scan_req {
bfc848c632c9eacb2a640246d96e198f1b185c03jm uint32_t vsr_idx;
bfc848c632c9eacb2a640246d96e198f1b185c03jm uint32_t vsr_seqnum;
911106dfb16696472af8c1b7b4c554a829354fa8jm uint64_t vsr_size;
bfc848c632c9eacb2a640246d96e198f1b185c03jm uint32_t vsr_flags;
911106dfb16696472af8c1b7b4c554a829354fa8jm uint8_t vsr_modified;
911106dfb16696472af8c1b7b4c554a829354fa8jm uint8_t vsr_quarantined;
911106dfb16696472af8c1b7b4c554a829354fa8jm char vsr_path[MAXPATHLEN];
911106dfb16696472af8c1b7b4c554a829354fa8jm vs_scanstamp_t vsr_scanstamp;
911106dfb16696472af8c1b7b4c554a829354fa8jm} vs_scan_req_t;
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm
bfc848c632c9eacb2a640246d96e198f1b185c03jm/* passed in VS_IOCTL_RESULT - async response from vscand */
bfc848c632c9eacb2a640246d96e198f1b185c03jmtypedef struct vs_scan_rsp {
bfc848c632c9eacb2a640246d96e198f1b185c03jm uint32_t vsr_idx;
bfc848c632c9eacb2a640246d96e198f1b185c03jm uint32_t vsr_seqnum;
bfc848c632c9eacb2a640246d96e198f1b185c03jm uint32_t vsr_result;
bfc848c632c9eacb2a640246d96e198f1b185c03jm vs_scanstamp_t vsr_scanstamp;
bfc848c632c9eacb2a640246d96e198f1b185c03jm} vs_scan_rsp_t;
bfc848c632c9eacb2a640246d96e198f1b185c03jm
bfc848c632c9eacb2a640246d96e198f1b185c03jm
bfc848c632c9eacb2a640246d96e198f1b185c03jm/* passed in VS_IOCTL_CONFIG */
911106dfb16696472af8c1b7b4c554a829354fa8jmtypedef struct vs_config {
911106dfb16696472af8c1b7b4c554a829354fa8jm char vsc_types[VS_TYPES_LEN];
911106dfb16696472af8c1b7b4c554a829354fa8jm uint64_t vsc_types_len;
911106dfb16696472af8c1b7b4c554a829354fa8jm uint64_t vsc_max_size; /* files > max size (bytes) not scan */
911106dfb16696472af8c1b7b4c554a829354fa8jm uint64_t vsc_allow; /* allow access to file exceeding max_size? */
911106dfb16696472af8c1b7b4c554a829354fa8jm} vs_config_t;
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm#ifdef _KERNEL
911106dfb16696472af8c1b7b4c554a829354fa8jmint vscan_svc_init(void);
911106dfb16696472af8c1b7b4c554a829354fa8jmvoid vscan_svc_fini(void);
bfc848c632c9eacb2a640246d96e198f1b185c03jmint vscan_svc_enable(void);
53c110294d8b1410cabc201a52f94b03ae2ef448jmvoid vscan_svc_disable(void);
911106dfb16696472af8c1b7b4c554a829354fa8jmint vscan_svc_configure(vs_config_t *);
911106dfb16696472af8c1b7b4c554a829354fa8jmboolean_t vscan_svc_in_use(void);
bfc848c632c9eacb2a640246d96e198f1b185c03jmvoid vscan_svc_scan_result(vs_scan_rsp_t *);
bfc848c632c9eacb2a640246d96e198f1b185c03jmvoid vscan_svc_scan_abort(void);
911106dfb16696472af8c1b7b4c554a829354fa8jmvnode_t *vscan_svc_get_vnode(int);
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jmint vscan_door_init(void);
911106dfb16696472af8c1b7b4c554a829354fa8jmvoid vscan_door_fini(void);
911106dfb16696472af8c1b7b4c554a829354fa8jmint vscan_door_open(int);
911106dfb16696472af8c1b7b4c554a829354fa8jmvoid vscan_door_close(void);
911106dfb16696472af8c1b7b4c554a829354fa8jmint vscan_door_scan_file(vs_scan_req_t *);
911106dfb16696472af8c1b7b4c554a829354fa8jm
53c110294d8b1410cabc201a52f94b03ae2ef448jmboolean_t vscan_drv_create_node(int);
53c110294d8b1410cabc201a52f94b03ae2ef448jm
911106dfb16696472af8c1b7b4c554a829354fa8jm#endif /* _KERNEL */
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm#ifdef __cplusplus
911106dfb16696472af8c1b7b4c554a829354fa8jm}
911106dfb16696472af8c1b7b4c554a829354fa8jm#endif
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm#endif /* _VSCAN_H */